Re: [PATCH] mtd: mtdpart: validate partition bounds in mtd_add_partition()

From: Miquel Raynal

Date: Mon Jun 29 2026 - 10:49:47 EST


On Sun, 21 Jun 2026 04:26:25 +0530, Deepanshu Kartikey wrote:
> mtd_add_partition() checks that 'length' is positive but does not
> validate that 'offset + length' fits within the parent partition's
> size. A userspace caller using the BLKPG_ADD_PARTITION ioctl can
> supply a crafted large 'length' value that passes the length <= 0
> check, causing add_mtd_device() to fire a WARN_ON() when it detects
> the oversized partition.
>
> [...]

Applied to mtd/fixes, thanks!

[1/1] mtd: mtdpart: validate partition bounds in mtd_add_partition()
commit: a74e31d0a2d52c65d9a6647c87b54bf78c0d9317

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