* [PATCH v3 3/9] mtd: rawnand: onfi: Fix redundancy detection check [not found] <20200428094302.14624-1-miquel.raynal@bootlin.com> @ 2020-04-28 9:42 ` Miquel Raynal 2020-05-01 2:55 ` Sasha Levin 2020-05-10 20:05 ` Miquel Raynal 0 siblings, 2 replies; 3+ messages in thread From: Miquel Raynal @ 2020-04-28 9:42 UTC (permalink / raw) To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd Cc: Boris Brezillon, Thomas Petazzoni, Miquel Raynal, stable 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: 39138c1f4a31 ("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> --- drivers/mtd/nand/raw/nand_onfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/nand_onfi.c b/drivers/mtd/nand/raw/nand_onfi.c index 0b879bd0a68c..8fe8d7bdd203 100644 --- a/drivers/mtd/nand/raw/nand_onfi.c +++ b/drivers/mtd/nand/raw/nand_onfi.c @@ -173,7 +173,7 @@ int nand_onfi_detect(struct nand_chip *chip) } if (onfi_crc16(ONFI_CRC_BASE, (u8 *)&p[i], 254) == - le16_to_cpu(p->crc)) { + le16_to_cpu(p[i].crc)) { if (i) memcpy(p, &p[i], sizeof(*p)); break; -- 2.20.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 3/9] mtd: rawnand: onfi: Fix redundancy detection check 2020-04-28 9:42 ` [PATCH v3 3/9] mtd: rawnand: onfi: Fix redundancy detection check Miquel Raynal @ 2020-05-01 2:55 ` Sasha Levin 2020-05-10 20:05 ` Miquel Raynal 1 sibling, 0 replies; 3+ messages in thread From: Sasha Levin @ 2020-05-01 2:55 UTC (permalink / raw) To: Sasha Levin, Miquel Raynal, Richard Weinberger Cc: Boris Brezillon, stable, stable Hi [This is an automated email] This commit has been processed because it contains a "Fixes:" tag fixing commit: 39138c1f4a31 ("mtd: rawnand: use bit-wise majority to recover the ONFI param page"). The bot has tested the following trees: v5.6.7, v5.4.35, v4.19.118. v5.6.7: Build OK! v5.4.35: Build OK! v4.19.118: Failed to apply! Possible dependencies: 0f808c1602bc ("mtd: rawnand: Pass a nand_chip object to chip->cmd_ctrl()") 1c325cc5077a ("mtd: rawnand: Move ONFI code to nand_onfi.c") 348d56a8c606 ("mtd: rawnand: Keep all internal stuff private") 3d4af7c19585 ("mtd: rawnand: Move legacy code to nand_legacy.c") 45240367939b ("mtd: rawnand: Deprecate ->{set,get}_features() hooks") 47bd59e538d4 ("mtd: rawnand: plat_nand: Pass a nand_chip object to all platform_nand_ctrl hooks") 716bbbabcc68 ("mtd: rawnand: Deprecate ->{read, write}_{byte, buf}() hooks") 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx() hooks") 82fc5099744e ("mtd: rawnand: Create a legacy struct and move ->IO_ADDR_{R, W} there") c0739d85723a ("mtd: rawnand: Pass a nand_chip object to chip->write_xxx() hooks") NOTE: The patch will not be queued to stable trees until it is upstream. How should we proceed with this patch? -- Thanks Sasha ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 3/9] mtd: rawnand: onfi: Fix redundancy detection check 2020-04-28 9:42 ` [PATCH v3 3/9] mtd: rawnand: onfi: Fix redundancy detection check Miquel Raynal 2020-05-01 2:55 ` Sasha Levin @ 2020-05-10 20:05 ` Miquel Raynal 1 sibling, 0 replies; 3+ messages in thread From: Miquel Raynal @ 2020-05-10 20:05 UTC (permalink / raw) To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd Cc: Boris Brezillon, stable, Thomas Petazzoni On Tue, 2020-04-28 at 09:42:56 UTC, Miquel Raynal wrote: > 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: 39138c1f4a31 ("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> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next. Miquel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-10 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200428094302.14624-1-miquel.raynal@bootlin.com>
2020-04-28 9:42 ` [PATCH v3 3/9] mtd: rawnand: onfi: Fix redundancy detection check Miquel Raynal
2020-05-01 2:55 ` Sasha Levin
2020-05-10 20:05 ` Miquel Raynal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).