{"id":"CVE-2026-138869","summary":"md: don't hand out the array before md_alloc() has added mddev-\u003ekobj","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmd: don't hand out the array before md_alloc() has added mddev-\u003ekobj\n\nmd_alloc() publishes the gendisk before it is done setting the mddev up:\n\n\tdisk-\u003eprivate_data = mddev;\n\t...\n\terror = add_disk(disk);\n\tif (error)\n\t\tgoto out_put_disk;\n\n\tkobject_init(&mddev-\u003ekobj, &md_ktype);\n\terror = kobject_add(&mddev-\u003ekobj, &disk_to_dev(disk)-\u003ekobj, \"%s\", \"md\");\n\nadd_disk() makes /dev/mdN openable.  mddev comes from mddev_alloc() and\nis zeroed, so anything that gets in between add_disk() and kobject_add()\nsees an mddev-\u003ekobj that has never been through kobject_init() - no\nktype, no kref, state_initialized clear.\n\nsyzbot opens the array in that window and issues ADD_NEW_DISK:\n\n  kobject: '(null)' (ffff8880120640f0): is not initialized, yet\n  kobject_get() is being called.\n  WARNING: lib/kobject.c:642 at kobject_add_internal+0xea/0xcd0 lib/kobject.c:225\n   kobject_add_varg lib/kobject.c:374 [inline]\n   kobject_add+0x163/0x240 lib/kobject.c:426\n   bind_rdev_to_array+0x80c/0xdd0 drivers/md/md.c:2621\n   md_add_new_disk+0xe3b/0x1850 drivers/md/md.c:7684\n   md_ioctl+0x200a/0x2610 drivers/md/md.c:8499\n\nbind_rdev_to_array() is not the only way in.  md_run() calls\nsysfs_create_group(&mddev-\u003ekobj, &md_redundancy_group), and\ninternal_create_group() has its own WARN_ON(!kobj-\u003esd), so RUN_ARRAY in\nthe same window warns too.\n\nEvery ioctl that can reach mddev-\u003ekobj runs under reconfig_mutex, so\nhold it across add_disk() and kobject_add().  An ioctl issued in the\nwindow now waits for md_alloc() to finish instead of seeing a\nhalf-built mddev, and opening the array still succeeds.  The ioctls\nmd_ioctl() serves without the mutex only read array state and return\n-ENODEV on an array with no disks.\n\nHoisting kobject_init() above add_disk() is not an option: commit\nca39f7502425 (\"md: fix mddev-\u003ekobj lifetime\") moved it below add_disk()\nso that md_alloc()'s error paths, which free the mddev directly, never\nsee an initialised kobject.","modified":"2026-12-01T21:02:35.021305397Z","published":"2026-11-30T13:25:44.890Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138869.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/147a2a108156ca807b6ffc823faf1804cd6a11c5"},{"type":"WEB","url":"https://git.kernel.org/stable/c/49f6bd347a7b7da90aabc213b58eec620c295d64"},{"type":"WEB","url":"https://git.kernel.org/stable/c/87651ed2b269bf62879a61b461aae4286e1ae1ed"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8b4800ff31c956d4f4bd45b371e5b9e733a95401"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c07902b838145371d5c6d49b1be8a49ace387c06"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d1472ca2ca5de8ecd2b358411eb14c031404ecf0"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138869.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138869"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"ca39f7502425d437cbf83d29d99b43bd61342858"},{"fixed":"c07902b838145371d5c6d49b1be8a49ace387c06"},{"fixed":"87651ed2b269bf62879a61b461aae4286e1ae1ed"},{"fixed":"8b4800ff31c956d4f4bd45b371e5b9e733a95401"},{"fixed":"49f6bd347a7b7da90aabc213b58eec620c295d64"},{"fixed":"147a2a108156ca807b6ffc823faf1804cd6a11c5"},{"fixed":"d1472ca2ca5de8ecd2b358411eb14c031404ecf0"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138869.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.0.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-138869.json"}}],"schema_version":"1.9.2"}