diff options
author | Todd Poynor <tpoynor@mvista.com> | 2005-11-04 22:21:15 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 20:24:31 -0500 |
commit | 868801e561d5d6df40a66197e2f803a109c19e7a (patch) | |
tree | f13cc0daeda783d3710161a8a641573c76bea600 /drivers/mtd | |
parent | 49196f3332e661ccc221734c3103115d8cd4ee49 (diff) |
[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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index c7b1ce38c63c..c18ea76ed408 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/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, | |||
1722 | startpage = page; | 1722 | startpage = page; |
1723 | oobbuf = nand_prepare_oobbuf (mtd, eccbuf, oobsel, | 1723 | oobbuf = nand_prepare_oobbuf (mtd, eccbuf, oobsel, |
1724 | autoplace, numpages); | 1724 | autoplace, numpages); |
1725 | oob = 0; | ||
1725 | /* Check, if we cross a chip boundary */ | 1726 | /* Check, if we cross a chip boundary */ |
1726 | if (!page) { | 1727 | if (!page) { |
1727 | chipnr++; | 1728 | chipnr++; |