Skip to content

Commit

Permalink
mtd: spinand: Fix OOB read
Browse files Browse the repository at this point in the history
commit 868cbe2 upstream.

So far OOB have never been used in SPI-NAND, add the missing memcpy to
make it work properly.

Fixes: 7529df4 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20201001102014.20100-6-miquel.raynal@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
miquelraynal authored and gregkh committed Dec 30, 2020
1 parent 3bcf022 commit baad618
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/mtd/nand/spi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
buf += ret;
}

if (req->ooblen)
memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs,
req->ooblen);

return 0;
}

Expand Down

0 comments on commit baad618

Please sign in to comment.