{"id":"CVE-2026-138869","aliases":["CVE-2026-138869"],"related":[],"kind":"vulnerability","state":"published","title":"md: don't hand out the array before md_alloc() has added mddev->kobj","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmd: don't hand out the array before md_alloc() has added mddev->kobj\n\nmd_alloc() publishes the gendisk before it is done setting the mddev up:\n\n\tdisk->private_data = mddev;\n\t...\n\terror = add_disk(disk);\n\tif (error)\n\t\tgoto out_put_disk;\n\n\tkobject_init(&mddev->kobj, &md_ktype);\n\terror = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, \"%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->kobj 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->kobj, &md_redundancy_group), and\ninternal_create_group() has its own WARN_ON(!kobj->sd), so RUN_ARRAY in\nthe same window warns too.\n\nEvery ioctl that can reach mddev->kobj 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->kobj lifetime\") moved it below add_disk()\nso that md_alloc()'s error paths, which free the mddev directly, never\nsee an initialised kobject.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmd: don't hand out the array before md_alloc() has added mddev->kobj\n\nmd_alloc() publishes the gendisk before it is done setting the mddev up:\n\n\tdisk->private_data = mddev;\n\t...\n\terror = add_disk(disk);\n\tif (error)\n\t\tgoto out_put_disk;\n\n\tkobject_init(&mddev->kobj, &md_ktype);\n\terror = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, \"%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->kobj 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->kobj, &md_redundancy_group), and\ninternal_create_group() has its own WARN_ON(!kobj->sd), so RUN_ARRAY in\nthe same window warns too.\n\nEvery ioctl that can reach mddev->kobj 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->kobj lifetime\") moved it below add_disk()\nso that md_alloc()'s error paths, which free the mddev directly, never\nsee an initialised kobject.","source":"cvelist"}],"published":"2026-11-30T13:25:44.890Z","modified":"2026-11-30T14:17:43.580Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"ca39f7502425d437cbf83d29d99b43bd61342858","fixed":"c07902b838145371d5c6d49b1be8a49ace387c06","status":"affected"},{"type":"git","introduced":"ca39f7502425d437cbf83d29d99b43bd61342858","fixed":"87651ed2b269bf62879a61b461aae4286e1ae1ed","status":"affected"},{"type":"git","introduced":"ca39f7502425d437cbf83d29d99b43bd61342858","fixed":"8b4800ff31c956d4f4bd45b371e5b9e733a95401","status":"affected"},{"type":"git","introduced":"ca39f7502425d437cbf83d29d99b43bd61342858","fixed":"49f6bd347a7b7da90aabc213b58eec620c295d64","status":"affected"},{"type":"git","introduced":"ca39f7502425d437cbf83d29d99b43bd61342858","fixed":"147a2a108156ca807b6ffc823faf1804cd6a11c5","status":"affected"},{"type":"git","introduced":"ca39f7502425d437cbf83d29d99b43bd61342858","fixed":"d1472ca2ca5de8ecd2b358411eb14c031404ecf0","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.0","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.0","status":"unaffected"},{"type":"semver","introduced":"6.1.193","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.163","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.117","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.63","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.4","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/c07902b838145371d5c6d49b1be8a49ace387c06","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/87651ed2b269bf62879a61b461aae4286e1ae1ed","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/8b4800ff31c956d4f4bd45b371e5b9e733a95401","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/49f6bd347a7b7da90aabc213b58eec620c295d64","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/147a2a108156ca807b6ffc823faf1804cd6a11c5","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/d1472ca2ca5de8ecd2b358411eb14c031404ecf0","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-138869","url":"https://www.cve.org/CVERecord?id=CVE-2026-138869","licence":"CVE Terms of Use","modified":"2026-11-30T13:25:44.890Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-138869","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138869","licence":"Public domain","modified":"2026-11-30T14:17:43.580Z"}],"updatedAt":"2026-11-30T14:32:36.539Z","epss":{"score":0.00215,"percentile":0.12702,"date":"2026-12-01T12:00:22.000Z"}}