{"id":"CVE-2026-138991","summary":"md: validate bblog_size when loading v1.x badblocks metadata","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmd: validate bblog_size when loading v1.x badblocks metadata\n\nIn super_1_load(), when the on-disk feature_map does not have\nMD_FEATURE_BAD_BLOCKS set but sb-\u003ebblog_offset is non-zero,\nrdev-\u003ebadblocks.shift is initialized to 0 without validating\nsb-\u003ebblog_size.  The same field is validated in the\nMD_FEATURE_BAD_BLOCKS branch (\"sectors \u003e (PAGE_SIZE / 512)\"), but this\nbranch bypasses that check.\n\nA forged on-disk superblock (malicious storage device or crafted\nimage) can therefore carry an oversized sb-\u003ebblog_size.  When bad\nblocks are later recorded, super_1_sync() sets bb-\u003esize from\nsb-\u003ebblog_size and md_write_metadata() issues a bio larger than the\nsingle rdev-\u003ebb_page, reading beyond the page and leaking kernel\nmemory contents to disk.\n\nsb-\u003ebblog_size is never modified by the kernel between load and sync,\nand the MD_FEATURE_BAD_BLOCKS branch already validates it, so checking\nit in this branch is sufficient to cover both paths.\n\nFix this by rejecting an oversized sb-\u003ebblog_size with -EINVAL,\nmatching the existing check in the MD_FEATURE_BAD_BLOCKS branch.","modified":"2026-11-30T15:01:43.057236038Z","published":"2026-11-30T13:26:51.892Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138991.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/1b9c1af3039596f2374225a5f6c9962a2a117192"},{"type":"WEB","url":"https://git.kernel.org/stable/c/2a0088960aeec328c0afa34df324192594212bf8"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6161721e0cc7cc45be5d4b2edfbec7d3f211bfeb"},{"type":"WEB","url":"https://git.kernel.org/stable/c/750960f85f5467d7271b54ddc215e5800b0a08db"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ae5f89b23cb88667cfa1273b42d6a551db9c651e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/e507b6589712e72bb1f5eeac17f4bbfce48eb9a7"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ed3334dc84bdb5d5062955c4aece6b5bfb6a68c9"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ed89d13541c89246fd410b2d95861096ad3d43c1"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138991.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138991"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"2699b67223aca6b1450fc2f72e40fada952afc85"},{"fixed":"2a0088960aeec328c0afa34df324192594212bf8"},{"fixed":"1b9c1af3039596f2374225a5f6c9962a2a117192"},{"fixed":"ed3334dc84bdb5d5062955c4aece6b5bfb6a68c9"},{"fixed":"e507b6589712e72bb1f5eeac17f4bbfce48eb9a7"},{"fixed":"6161721e0cc7cc45be5d4b2edfbec7d3f211bfeb"},{"fixed":"750960f85f5467d7271b54ddc215e5800b0a08db"},{"fixed":"ed89d13541c89246fd410b2d95861096ad3d43c1"},{"fixed":"ae5f89b23cb88667cfa1273b42d6a551db9c651e"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138991.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.1.0"},{"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.117"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.63"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138991.json"}}],"schema_version":"1.9.2"}