{"id":"CVE-2026-99540","aliases":[],"title":"ksmbd: fix parent dentry lifetime in directory enumeration","originalDescription":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix parent dentry lifetime in directory enumeration\n\nksmbd_populate_dot_dotdot_entries() builds the \"..\" entry from\nthe open directory's d_parent and passes that pointer to\nksmbd_vfs_fill_dentry_attrs() without taking a reference. That pointer\nis only valid while the directory stays under this parent. If a\nconcurrent rename moves the directory elsewhere, the old parent loses\nits last reference; a following rmdir then turns it into a negative\ndentry with d_inode cleared, and after the RCU grace period the dentry\nitself is freed. The worker still holds the raw pointer and\ndereferences d_inode through vfs_getattr() and vfs_getxattr().\n\nA remote SMB client, authenticated or guest, triggers this by listing\na directory while that directory is moved under a new parent and the\nold parent is deleted. It can be done by the client itself with write\naccess or by other concurrent writers, triggering null-ptr-deref and\nslab-use-after-free on a KASAN build.\n\n  KASAN: null-ptr-deref in range\n      [0x0000000000000000-0x0000000000000007]\n  Workqueue: ksmbd-io handle_ksmbd_work\n  RIP: 0010:xattr_permission+0x9d/0x160\n  Call Trace:\n   vfs_getxattr+0x9c/0x1b0\n   ksmbd_vfs_getxattr+0x82/0x100\n   ksmbd_vfs_get_dos_attrib_xattr+0x7f/0x130\n   ksmbd_vfs_fill_dentry_attrs+0x435/0x650\n   ksmbd_populate_dot_dotdot_entries+0x25e/0x630\n   smb2_query_dir+0xcf9/0x1a20\n   handle_ksmbd_work+0x5f1/0x1c80\n   process_one_work+0x90b/0x19d0\n\nFix by using the dentry reference counting APIs: take the parent with\ndget_parent(), take a matching dget() on \".\", and dput() the dentry\nonce ksmbd_vfs_fill_dentry_attrs() has returned or the pattern does\nnot match.","severity":{"cvss":8.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","label":"high"},"exploitation":{"kev":null,"epss":{"score":0.00531,"percentile":0.46418},"exploitDb":null},"affected":[{"ecosystem":"Linux","name":"Kernel","range":">=5.15.0, <6.1.193","fixed":"6.1.193"},{"ecosystem":"Linux","name":"Kernel","range":">=5.15.0, <6.12.117","fixed":"6.12.117"},{"ecosystem":"Linux","name":"Kernel","range":">=6.13.0, <6.18.61","fixed":"6.18.61"},{"ecosystem":"Linux","name":"Kernel","range":">=6.19.0, <7.3.2","fixed":"7.3.2"},{"ecosystem":"Linux","name":"Kernel","range":">=6.2.0, <6.6.163","fixed":"6.6.163"},{"ecosystem":"Linux","name":"Kernel","range":">=6.7.0, <6.12.117","fixed":"6.12.117"},{"ecosystem":"vendor","name":"Linux","range":">=e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9, <171df27077fb49b4af2c53ad2cedcd0e39664fe8","fixed":"171df27077fb49b4af2c53ad2cedcd0e39664fe8"},{"ecosystem":"vendor","name":"Linux","range":">=e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9, <32934b13b1a63c86d2fa68df0bfb28c51ce38879","fixed":"32934b13b1a63c86d2fa68df0bfb28c51ce38879"},{"ecosystem":"vendor","name":"Linux","range":">=e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9, <93566781118cdff874023d5ca4e7b8054baaec31","fixed":"93566781118cdff874023d5ca4e7b8054baaec31"},{"ecosystem":"vendor","name":"Linux","range":">=e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9, <b62ef8cfec9351662e42cbf7da2d743068699bba","fixed":"b62ef8cfec9351662e42cbf7da2d743068699bba"},{"ecosystem":"vendor","name":"Linux","range":">=e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9, <cdc9a843b4688fa2729ddaf3e575dadd243aacc1","fixed":"cdc9a843b4688fa2729ddaf3e575dadd243aacc1"},{"ecosystem":"vendor","name":"Linux","range":">=e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9, <e8af427da35cf10c9d26b96d91b6849dd01e125c","fixed":"e8af427da35cf10c9d26b96d91b6849dd01e125c"}],"references":[{"url":"https://git.kernel.org/stable/c/32934b13b1a63c86d2fa68df0bfb28c51ce38879","type":"other"},{"url":"https://git.kernel.org/stable/c/93566781118cdff874023d5ca4e7b8054baaec31","type":"other"},{"url":"https://git.kernel.org/stable/c/b62ef8cfec9351662e42cbf7da2d743068699bba","type":"other"},{"url":"https://git.kernel.org/stable/c/171df27077fb49b4af2c53ad2cedcd0e39664fe8","type":"other"},{"url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","type":"package"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99540.json","type":"advisory"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99540","type":"advisory"},{"url":"https://git.kernel.org/stable/c/cdc9a843b4688fa2729ddaf3e575dadd243aacc1","type":"other"},{"url":"https://git.kernel.org/stable/c/e8af427da35cf10c9d26b96d91b6849dd01e125c","type":"other"}],"sources":[{"name":"nvd","at":"2026-11-23T08:46:27.353Z","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99540","license":"NVD terms of use","firstSeenAt":"2026-11-19T15:43:48.239Z"},{"name":"osv","at":"2026-12-01T11:52:49.057Z","url":"https://osv.dev/vulnerability/CVE-2026-99540","license":"CC-BY 4.0","firstSeenAt":"2026-11-19T17:23:43.634Z"},{"name":"cvelistV5","at":"2026-11-23T21:30:55.621Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-99540","license":"CVE Terms of Use","firstSeenAt":"2026-11-19T15:00:34.286Z"}],"firstSeenAt":"2026-11-19T15:00:34.286Z","publishedAt":"2026-11-19T14:44:55.292Z","modifiedAt":"2026-12-01T10:42:30.882Z"}