From: Miquel Raynal Date: Thu, 1 Oct 2020 10:20:13 +0000 (+0200) Subject: mtd: spinand: Fix OOB read X-Git-Tag: v4.19.164~25 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=835c72e1d27773b22f62a8429125fea912698425;p=users%2Fdwmw2%2Flinux.git mtd: spinand: Fix OOB read commit 868cbe2a6dcee451bd8f87cbbb2a73cf463b57e5 upstream. So far OOB have never been used in SPI-NAND, add the missing memcpy to make it work properly. Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20201001102014.20100-6-miquel.raynal@bootlin.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 1d61ae7aaa66c..83954f424d413 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -378,6 +378,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, } } + if (req->ooblen) + memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, + req->ooblen); + return 0; }