]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: onfi: Fix redundancy detection check
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 28 Apr 2020 09:42:56 +0000 (11:42 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 11 May 2020 07:51:40 +0000 (09:51 +0200)
commit0fca1a34d7fe7adf4adc71dad0e6f8197ddfed89
tree2cd8d55f53db03a1eaca7cedf71582d66455798d
parentb89309a16dd17b9b41ef8e100adfefa9859d9446
mtd: rawnand: onfi: Fix redundancy detection check

During ONFI detection, the CRC derived from the parameter page and the
CRC supposed to be at the end of the parameter page are compared. If
they do not match, the second then the third copies of the page are
tried.

The current implementation compares the newly derived CRC with the CRC
contained in the first page only. So if this particular CRC area has
been corrupted, then the detection will fail for a wrong reason.

Fix this issue by checking the derived CRC against the right one.

Fixes: c91c0bb86bc9 ("mtd: rawnand: use bit-wise majority to recover the ONFI param page")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-4-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/nand_onfi.c