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>
                return -EINVAL;
        }
 
+       /* For compatibility with NAND: Do not allow write past end of page */
+       if (column + len > oobsize) {
+               DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: "
+                     "Attempt to write past end of page\n");
+               return -EINVAL;
+       }
+
        /* Do not allow reads past end of device */
        if (unlikely(to >= mtd->size ||
                     column + len > ((mtd->size >> this->page_shift) -