{"id":"CVE-2026-139682","summary":"md/raid5: don't BUG() on an inconsistent reshape state from the superblock","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmd/raid5: don't BUG() on an inconsistent reshape state from the superblock\n\nraid5_run() branches on mddev-\u003ereshape_position. When it is MaxSector --\nno reshape in progress -- the else branch asserts that nothing else\ndescribes one:\n\n\tBUG_ON(mddev-\u003elevel != mddev-\u003enew_level);\n\tBUG_ON(mddev-\u003elayout != mddev-\u003enew_layout);\n\tBUG_ON(mddev-\u003echunk_sectors != mddev-\u003enew_chunk_sectors);\n\tBUG_ON(mddev-\u003edelta_disks != 0);\n\nNothing enforces that invariant. Both superblock validators copy the\nreshape fields straight off disk without cross-checking them against\neach other: super_1_validate() takes reshape_position, delta_disks,\nnew_level, new_layout and new_chunk from the superblock whenever\nMD_FEATURE_RESHAPE_ACTIVE is set, and super_90_validate() does the same\nfor minor version 91. A superblock that sets the reshape feature while\nleaving reshape_position at the MaxSector sentinel therefore reaches the\nelse branch with a non-zero delta_disks, and assembling the array takes\nthe machine down:\n\n  kernel BUG at drivers/md/raid5.c:8117!\n  Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI\n  RIP: 0010:raid5_run+0x11a7/0x1670 drivers/md/raid5.c:8117\n  Call Trace:\n   md_run+0xc2f/0x2510 drivers/md/md.c:6779\n   do_md_run+0x36/0x660 drivers/md/md.c:6880\n   array_state_store+0x9c5/0xcf0 drivers/md/md.c:4765\n   md_attr_store+0x1c5/0x330 drivers/md/md.c:6158\n   sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145\n   kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345\n\nThis is reachable by anyone who can present an md superblock, so BUG()\nis the wrong response. Refuse to start the array instead, the way the\nreshape_position != MaxSector branch a few lines above already refuses a\nreshape it cannot resume. Nothing has been allocated at this point --\nthe journal-and-bitmap check just above returns -EINVAL the same way --\nso there is nothing to unwind.","modified":"2026-11-30T15:02:30.202999588Z","published":"2026-11-30T13:37:00.369Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139682.json","cna_assigner":"Linux"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/0669c7dbd1d375f279e607a24addc2f1dae2d4f3"},{"type":"WEB","url":"https://git.kernel.org/stable/c/136a221544d919896a0f1bff8802eb51d0dff496"},{"type":"WEB","url":"https://git.kernel.org/stable/c/50485f1be262c2085443662b4a8be084fa958b9d"},{"type":"WEB","url":"https://git.kernel.org/stable/c/57926a227a2d610f586b99de2638a02b72e99762"},{"type":"WEB","url":"https://git.kernel.org/stable/c/996c0df409b1cf2d4e9bb0dce0cb4ba0c1f50ed7"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c093f0dd9119bee681facb5af2efbe476945666c"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ef2a78ba818d0cd046c2f1614aebd200a26e01d6"},{"type":"WEB","url":"https://git.kernel.org/stable/c/fa4122799a5bff6902848eafa00dc8e245ba261f"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139682.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139682"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"91adb56473febeeb3ef657bb5147ddd355465700"},{"fixed":"996c0df409b1cf2d4e9bb0dce0cb4ba0c1f50ed7"},{"fixed":"c093f0dd9119bee681facb5af2efbe476945666c"},{"fixed":"ef2a78ba818d0cd046c2f1614aebd200a26e01d6"},{"fixed":"50485f1be262c2085443662b4a8be084fa958b9d"},{"fixed":"136a221544d919896a0f1bff8802eb51d0dff496"},{"fixed":"57926a227a2d610f586b99de2638a02b72e99762"},{"fixed":"fa4122799a5bff6902848eafa00dc8e245ba261f"},{"fixed":"0669c7dbd1d375f279e607a24addc2f1dae2d4f3"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139682.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.30"},{"fixed":"5.10.275"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.226"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.193"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.119"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.65"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139682.json"}}],"schema_version":"1.9.2"}