AZL-115055: CVE-2026-99540 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix parent dentry lifetime in directory enumeration
ksmbdpopulatedotdotdotentries() builds the ".." entry from the open directory's dparent and passes that pointer to ksmbdvfsfilldentryattrs() without taking a reference. That pointer is only valid while the directory stays under this parent. If a concurrent rename moves the directory elsewhere, the old parent loses its last reference; a following rmdir then turns it into a negative dentry with dinode cleared, and after the RCU grace period the dentry itself is freed. The worker still holds the raw pointer and dereferences dinode through vfsgetattr() and vfsgetxattr().
A remote SMB client, authenticated or guest, triggers this by listing a directory while that directory is moved under a new parent and the old parent is deleted. It can be done by the client itself with write access or by other concurrent writers, triggering null-ptr-deref and slab-use-after-free on a KASAN build.
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] Workqueue: ksmbd-io handleksmbdwork RIP: 0010:xattrpermission+0x9d/0x160 Call Trace: vfsgetxattr+0x9c/0x1b0 ksmbdvfsgetxattr+0x82/0x100 ksmbdvfsgetdosattribxattr+0x7f/0x130 ksmbdvfsfilldentryattrs+0x435/0x650 ksmbdpopulatedotdotdotentries+0x25e/0x630 smb2querydir+0xcf9/0x1a20 handleksmbdwork+0x5f1/0x1c80 processonework+0x90b/0x19d0
Fix by using the dentry reference counting APIs: take the parent with dgetparent(), take a matching dget() on ".", and dput() the dentry once ksmbdvfsfilldentryattrs() has returned or the pattern does not match.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In ksmbd_populate_dot_dotdot_entries(), use dget_parent() to hold the parent dentry, take a matching dget() on the "." dentry, and dput() the dentry after ksmbd_vfs_fill_dentry_attrs() returns or when the pattern does not match.