Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MTD] OneNAND: Do not allow oob write past end of page

OneNAND can write oob to successive pages, but NAND
does not do that. For compatibility, disallow OneNAND
from writing past the end of the page.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

authored by

Adrian Hunter and committed by
Kyungmin Park
52e4200a 5b4246f1

+7
+7
drivers/mtd/onenand/onenand_base.c
··· 1186 1186 return -EINVAL; 1187 1187 } 1188 1188 1189 + /* For compatibility with NAND: Do not allow write past end of page */ 1190 + if (column + len > oobsize) { 1191 + DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: " 1192 + "Attempt to write past end of page\n"); 1193 + return -EINVAL; 1194 + } 1195 + 1189 1196 /* Do not allow reads past end of device */ 1190 1197 if (unlikely(to >= mtd->size || 1191 1198 column + len > ((mtd->size >> this->page_shift) -