{"id":"CVE-2026-53125","summary":"md: fix array_state=clear sysfs deadlock","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmd: fix array_state=clear sysfs deadlock\n\nWhen \"clear\" is written to array_state, md_attr_store() breaks sysfs\nactive protection so the array can delete itself from its own sysfs\nstore method.\n\nHowever, md_attr_store() currently drops the mddev reference before\ncalling sysfs_unbreak_active_protection(). Once do_md_stop(..., 0)\nhas made the mddev eligible for delayed deletion, the temporary\nkobject reference taken by sysfs_break_active_protection() can become\nthe last kobject reference protecting the md kobject.\n\nThat allows sysfs_unbreak_active_protection() to drop the last\nkobject reference from the current sysfs writer context. kobject\nteardown then recurses into kernfs removal while the current sysfs\nnode is still being unwound, and lockdep reports recursive locking on\nkn-\u003eactive with kernfs_drain() in the call chain.\n\nReproducer on an existing level:\n1. Create an md0 linear array and activate it:\n   mknod /dev/md0 b 9 0\n   echo none \u003e /sys/block/md0/md/metadata_version\n   echo linear \u003e /sys/block/md0/md/level\n   echo 1 \u003e /sys/block/md0/md/raid_disks\n   echo \"$(cat /sys/class/block/sdb/dev)\" \u003e /sys/block/md0/md/new_dev\n   echo \"$(($(cat /sys/class/block/sdb/size) / 2))\" \u003e \\\n\t/sys/block/md0/md/dev-sdb/size\n   echo 0 \u003e /sys/block/md0/md/dev-sdb/slot\n   echo active \u003e /sys/block/md0/md/array_state\n2. Wait briefly for the array to settle, then clear it:\n   sleep 2\n   echo clear \u003e /sys/block/md0/md/array_state\n\nThe warning looks like:\n\n  WARNING: possible recursive locking detected\n  bash/588 is trying to acquire lock:\n  (kn-\u003eactive#65) at __kernfs_remove+0x157/0x1d0\n  but task is already holding lock:\n  (kn-\u003eactive#65) at sysfs_unbreak_active_protection+0x1f/0x40\n  ...\n  Call Trace:\n   kernfs_drain\n   __kernfs_remove\n   kernfs_remove_by_name_ns\n   sysfs_remove_group\n   sysfs_remove_groups\n   __kobject_del\n   kobject_put\n   md_attr_store\n   kernfs_fop_write_iter\n   vfs_write\n   ksys_write\n\nRestore active protection before mddev_put() so the extra sysfs\nkobject reference is dropped while the mddev is still held alive. The\nactual md kobject deletion is then deferred until after the sysfs\nwrite path has fully returned.","modified":"2026-06-26T12:06:23.541619690Z","published":"2026-06-24T16:30:53.934Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/53xxx/CVE-2026-53125.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/2aa72276fab9851dbd59c2daeb4b590c5a113908"},{"type":"WEB","url":"https://git.kernel.org/stable/c/62c44566da7493ee48ef17e8507bb798338a07cb"},{"type":"WEB","url":"https://git.kernel.org/stable/c/92ad0ec509ffb188d8f849b63148664df37b4a52"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/53xxx/CVE-2026-53125.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-53125"},{"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":"9e59d609763f70a992a8f3808dabcce60f14eb5c"},{"fixed":"62c44566da7493ee48ef17e8507bb798338a07cb"},{"fixed":"92ad0ec509ffb188d8f849b63148664df37b4a52"},{"fixed":"2aa72276fab9851dbd59c2daeb4b590c5a113908"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-53125.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.17.0"},{"fixed":"6.18.33"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.0.10"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-53125.json"}}],"schema_version":"1.7.5"}