[PATCH 0/2] mtd: onenand: fix OOB transfer lengths and offsets

From: James Hilliard

Date: Sat Dec 05 2026 - 01:53:48 EST


A spare-only read that ends partway through its last page can copy more
bytes than requested. Separately, OneNAND uses low bits of the main
data address to select spare bytes, so a read or write can start at the
wrong position within the spare area.

Limit the last read to the bytes still requested. Take the spare
offset from the OOB request and have the bad-block marker writer pass
its offset there as well.

Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>

---
James Hilliard (2):
mtd: onenand: limit the last spare-area read to the remaining bytes
mtd: onenand: take the spare-area column from the OOB request

drivers/mtd/nand/onenand/onenand_base.c | 130 ++++++++++----------------------
1 file changed, 40 insertions(+), 90 deletions(-)
---
base-commit: 4e5457fcbc14d21e7c004c3159e78fc63838029e
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
change-id: 20261204-submit-onenand-oob-fixes-v1-10db347cf4bc

Best regards,
--
James Hilliard <james.hilliard1@xxxxxxxxx>