{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99540","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2026-09-25T10:25:14.421Z","datePublished":"2026-11-19T14:44:55.292Z","dateUpdated":"2026-11-22T11:08:49.639Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-11-22T11:08:49.639Z"},"descriptions":[{"lang":"en","value":"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."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":8.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:N - An SMB2 QUERY_DIRECTORY PDU on TCP/445 is dispatched by handle_ksmbd_work() to smb2_query_dir(), which calls ksmbd_populate_dot_dotdot_entries() and passes the open directory's d_parent to ksmbd_vfs_fill_dentry_attrs() without a reference. The same client drops that parent with SMB2 SET_INFO FILE_RENAME_INFORMATION (__d_move) and delete-on-close rmdir (ksmbd_vfs_unlink).\nAC:L - The client creates a one-child parent, opens the child, and races QUERY_DIRECTORY against its own rename and parent delete. Those run as separate ksmbd-io works (WQ_PERCPU, max_active default); readdir_lock is only the listing ksmbd_file's mutex, so the attacker holds both sides and can repeat the race.\nPR:L - smb2_check_user_session() accepts SMB2_QUERY_DIRECTORY only for an SMB2_SESSION_VALID session, and the freeing side needs a writable tree: smb2_set_info() returns -EACCES without KSMBD_TREE_CONN_FLAG_WRITABLE and set_rename_info() requires FILE_DELETE on the open directory.\nUI:N - The attacker creates the directories, sends QUERY_DIRECTORY with a pattern that matches \"..\", renames the open directory, and closes the old parent with delete pending, all on sessions they opened.\nS:U - The dangling parent is dereferenced in the ksmbd-io worker via vfs_getattr() and vfs_getxattr(). A crash or resulting code execution stays in the host kernel that serves the share.\nC:H - The worker keeps the raw parent pointer across dentry_unlink_inode() and the RCU free in dentry_free(). vfs_getattr_nosec() and vfs_getxattr() then load d_inode and follow i_sb, i_op, and xattr handlers, so a reused slab slot discloses kernel memory through that pointer.\nI:H - On the freed parent, vfs_getattr_nosec() calls inode->i_op->getattr and vfs_getxattr() calls the xattr handler->get. Reclaiming the dentry slab before those calls gives a use-after-free of those function pointers and a kernel write/code-execution primitive.\nA:H - rmdir turns the unreferenced parent negative and dentry_kill() clears d_inode, which NULL-derefs in xattr_permission() via ksmbd_vfs_get_dos_attrib_xattr(); after call_rcu() in dentry_free() the same vfs_getattr()/vfs_getxattr() path is a slab use-after-free. Either oopses ksmbd-io."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/smb_common.c"],"versions":[{"version":"e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9","lessThan":"32934b13b1a63c86d2fa68df0bfb28c51ce38879","status":"affected","versionType":"git"},{"version":"e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9","lessThan":"93566781118cdff874023d5ca4e7b8054baaec31","status":"affected","versionType":"git"},{"version":"e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9","lessThan":"b62ef8cfec9351662e42cbf7da2d743068699bba","status":"affected","versionType":"git"},{"version":"e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9","lessThan":"171df27077fb49b4af2c53ad2cedcd0e39664fe8","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/smb_common.c"],"versions":[{"version":"5.15","status":"affected"},{"version":"0","lessThan":"5.15","status":"unaffected","versionType":"semver"},{"version":"6.12.117","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.18.61","lessThanOrEqual":"6.18.*","status":"unaffected","versionType":"semver"},{"version":"7.3.2","lessThanOrEqual":"7.3.*","status":"unaffected","versionType":"semver"},{"version":"7.4-rc1","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.18.61"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"7.4-rc1"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/32934b13b1a63c86d2fa68df0bfb28c51ce38879"},{"url":"https://git.kernel.org/stable/c/93566781118cdff874023d5ca4e7b8054baaec31"},{"url":"https://git.kernel.org/stable/c/b62ef8cfec9351662e42cbf7da2d743068699bba"},{"url":"https://git.kernel.org/stable/c/171df27077fb49b4af2c53ad2cedcd0e39664fe8"}],"title":"ksmbd: fix parent dentry lifetime in directory enumeration","x_generator":{"engine":"bippy-1.2.0"}}}}