소스 검색

[MTD] NAND: nand_write_ecc memory and OOB corruption

Nathan Roberts noticed the nand_write_ecc index into oobbuf goes out of
bounds when crossing an erase block boundary, causing incorrect OOB data
to be written and corrupting memory.  Reset the index to zero after
re-preparing oobbuf for a new erase block.

Signed-off-by: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Todd Poynor 20 년 전
부모
커밋
868801e561
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      drivers/mtd/nand/nand_base.c

+ 1 - 0
drivers/mtd/nand/nand_base.c

@@ -1722,6 +1722,7 @@ static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
 			startpage = page;
 			startpage = page;
 			oobbuf = nand_prepare_oobbuf (mtd, eccbuf, oobsel, 
 			oobbuf = nand_prepare_oobbuf (mtd, eccbuf, oobsel, 
 					autoplace, numpages);
 					autoplace, numpages);
+			oob = 0;
 			/* Check, if we cross a chip boundary */
 			/* Check, if we cross a chip boundary */
 			if (!page) {
 			if (!page) {
 				chipnr++;
 				chipnr++;