[PATCH] [MTD] OneNAND: Do not allow oob write past end of page
Kyungmin Park
kmpark at infradead.org
Mon Feb 5 21:15:37 EST 2007
Hi Adrian,
>
> OneNAND stuff which we have now is _part of MTD_. MTD has its
> interface, its model of the device. As long as we are part of
> this infrastructure, we have to obey MTD's interface, rules
> and restrictions.
>
> The whole idea of MTD is to make upper layers to access
> flashes in a uniform layer. MTD achieves this at certain
> extent. There are flaws, but anyway. So basically OneNAND
> implements more then NAND in this OOB handling stuff. And it
> is bad. It encourages other people to write OneNAND-only
> software, incompatible with NAND, which is totally
> unreasonable in this case.
>
I will push it.
BTW, after patch, we got dead code.
I downloaded oobtest again, re-run it and see that it trigger exception
code in onenand_do_write_oob
But it don't touch following codes whether include your patch or not.
/* Do not allow write past end of device */
if (unlikely(to >= mtd->size ||
column + len > ((mtd->size >> this->page_shift) -
(to >> this->page_shift)) * oobsize)) {
DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: Attempted to
write past end of device\n");
return -EINVAL;
}
Please check oobtest program.
Thank you,
Kyungmin Park
--
oobtest: Test 4 of 5
oobtest: erasing
oobtest: erased 0
oobtest: erased 128
oobtest: Attempting to start write past end of oob
oobtest: An error is expected...
oobtest: Error occurred as expected
oobtest: Attempting to start read past end of oob
oobtest: An error is expected...
oobtest: Error occurred as expected
oobtest: Attempting to write past end of device
oobtest: An error is expected...
-> onenand_write_oob: Attempt to write past end of page
oobtest: Error occurred as expected
oobtest: Attempting to read past end of device
oobtest: An error is expected...
oobtest: error: read past end of device
oobtest: Attempting to write past end of device
oobtest: An error is expected...
-> onenand_write_oob: Attempt to write past end of page
oobtest: Error occurred as expected
oobtest: Attempting to read past end of device
oobtest: An error is expected...
oobtest: error: read past end of device
More information about the linux-mtd
mailing list