Re: [PATCH] mtd: part: reject MTDPART_OFS_RETAIN in mtd_add_partition()

From: Miquel Raynal

Date: Fri Jul 17 2026 - 11:56:17 EST


On Thu, 16 Jul 2026 21:14:32 +0800, zhouminqiang wrote:
> mtd_add_partition() does not reject the special offset value
> MTDPART_OFS_RETAIN (-3), which leads to a WARN_ON in
> add_mtd_device() when called through the BLKPG ioctl on NAND
> devices. The RETAIN value depends on cur_offset being the end of
> the previous partition, but in the dynamic partition path
> cur_offset equals the offset argument itself, causing undefined
> behavior.
>
> [...]

Applied to mtd/next, thanks!

[1/1] mtd: part: reject MTDPART_OFS_RETAIN in mtd_add_partition()
commit: b759d5bb6265419344ee9729fd0dc07ad85719d8

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl