CVE-2026-99556: ksmbd: serialize directory emptiness checks with readdir

Published Nov 19, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: serialize directory emptiness checks with readdir

SMB2 QUERYDIRECTORY holds fp->readdirlock while it calls iteratedir() on fp->filp. An SMB2 SETINFO request with FILEDISPOSITIONINFORMATION can resolve the same FileId and call ksmbdvfsemptydir() on the same filp without that lock.

iteratedir()'s inode read lock permits concurrent readers and does not serialize per-file iterator state. ext4 stores its dx readdir cursor and fname RB tree in file->privatedata. Concurrent reset or refill can therefore free a fname node while the other worker still traverses it or retains its RB-tree link, resulting in use-after-free accesses.

An authenticated SMB client with list and delete rights on a directory in a writable KSMBD share backed by ext4 can trigger this when the directory takes the dx readdir path. The client overlaps an SMB2 QUERYDIRECTORY request with an SMB2 SETINFO request carrying FILEDISPOSITIONINFORMATION on one live FileId.

In one x8664 SMP KASAN multi-shot guest using ksmbd-for-next at 171df27077fb, the unmodified kernel reported a cross-worker use-after-free before a panic. The first report's access and free stacks show the two request paths directly (trimmed):

BUG: KASAN: slab-use-after-free in ext4htreestoredirent+0x488/0x550 Read of size 8 by task kworker/2:0/29 Workqueue: ksmbd-io handleksmbdwork Call Trace: ext4htreestoredirent+0x488/0x550 htreedirblocktotree+0x535/0x990 ext4htreefilltree+0x319/0xba0 ext4readdir+0x175a/0x2f40 iteratedir+0x1b6/0x630 smb2querydir+0x1003/0x1cc0

Freed by task 279: freerbtreefname+0x67/0xc0 ext4readdir+0x13a9/0x2f40 iteratedir+0x1b6/0x630 ksmbdvfsemptydir+0xa2/0x100 smb2setinfo+0x2ffa/0x45d0

Take fp->readdirlock across the entire emptiness check. This places both iterators over that handle's filp in the same lock domain while preserving the disposition status handling. The exact code change completed a warning-free x8664 KASAN bzImage build. Tracing three request pairs showed that the two iteratedir() calls no longer overlapped and the expected statuses were preserved. A further 1,600 reproducer iterations completed with expected statuses and no KASAN report, Oops, or panic.

The reproducer and complete guest configuration are available privately to maintainers on request.

Affected Software

3 affected componentsFixes available
linux/kernel>=5.15.0<6.12.117
6.12.117
linux/kernel>=6.13.0<6.18.61
6.18.61
linux/kernel>=6.19.0<7.3.2
7.3.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.12.117
  2. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.18.61
  3. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 7.3.2
  4. Compensating control

    In ksmbd, hold fp->readdir_lock across the entire directory-emptiness check in ksmbd_vfs_empty_dir() so iterators over the same filp are serialized.

Event History

Nov 19, 2026
CVE Published
via MITRE·02:45 PM
Data Sourced
via MITRE·02:45 PM
Description
Data Sourced
via OSV·02:45 PM
DescriptionAffected Software
Data Sourced
via NVD·03:18 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203