CVE-2026-93048: mtd: part: reject MTDPART_OFS_RETAIN in mtd_add_partition()

Published Sep 17, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

mtd: part: reject MTDPARTOFSRETAIN in mtdaddpartition()

mtdaddpartition() does not reject the special offset value MTDPARTOFSRETAIN (-3), which leads to a WARNON in addmtddevice() when called through the BLKPG ioctl on NAND devices. The RETAIN value depends on curoffset being the end of the previous partition, but in the dynamic partition path curoffset equals the offset argument itself, causing undefined behavior.

Commit 5daa7b21496a ("mtd: prepare partition add and del functions for ioctl requests") introduced mtdaddpartition() and correctly rejected MTDPARTOFSAPPEND (-1) and MTDPARTOFSNXTBLK (-2), since those special offsets rely on curoffset tracking the previous partition's end. However, commit 1a31368bf92e ("mtd: add a flags for partitions which should just leave smth. after them") later added MTDPARTOFSRETAIN (-3) for the static partition table path without updating mtdaddpartition() to also reject this value.

With offset=-3 passed via BLKPG, the RETAIN size calculation in allocatepartition() underflows (parentsize - 0xFFFFFFFFFFFFFFFD = parentsize + 3). If the underflow result does not appear to leave enough space, allocatepartition() jumps to outregister via goto, skipping erasesize initialization. This results in erasesize=0, which triggers:

WARNON((!mtd->erasesize || !master->erase) && !(mtd->flags & MTDNOERASE))

in addmtddevice(). If the underflow result appears to leave enough space, a bogus partition size is calculated, but the "out of reach" sanity check catches the invalid offset and creates a disabled empty partition (offset=0, size=0) instead of returning an error.

Fix this by adding MTDPARTOFSRETAIN to the rejection list in mtdaddpartition(), consistent with the existing handling of APPEND and NXTBLK.

Affected Software

1 affected component
Linux Kernel

Event History

Sep 17, 2026
CVE Published
via MITRE·04:10 PM
Data Sourced
via MITRE·04:10 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203