HIGH Introduced in 5.1
smb CachedDir UAF
CVE-2026-98452
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: smb: client: clean up failed cached directory opens open_cached_dir() sends CREATE and QUERY_INFO as a compound request. If the CREATE succeeds but a later command returns an error, the function must retain the CREATE FID so common cleanup can issue SMB2_close(). It also must not treat a response error as a valid CREATE. Validate the CREATE response before using its fields, record the FIDs, and mark the handle open before handling errors from later compound commands. Move the -EREMCHG reconnect handling before response validation so a missing response does not hide the reconnect request. Count the handle when it is marked open; confirmed close responses decrement the counter, while existing close retry behavior remains best effort on transport failures.
02KernelScan AI Analysis
Risk summary
A local unprivileged user who can mount an SMB share can trigger a use-after-free in the kernel's SMB client cached directory logic. The bug occurs when a compound CREATE+QUERY_INFO request partially fails: the CREATE succeeds but a later command errors, leaving the created file handle unclosed and the cached directory object in an inconsistent state. This allows heap corruption leading to privilege escalation or kernel crash.
Vulnerability analysis
The SMB client's open_cached_dir() function sends a compound request containing a CREATE and a QUERY_INFO command. In the original code, if the CREATE succeeded but the QUERY_INFO failed, the function did not properly validate the CREATE response before using its fields, did not mark the handle as open, and did not increment the open handle counter. This meant the created file ID (FID) was leaked — the server-side handle remained open but the client had no record of it — and the cached directory object could be freed while still referenced. The fix reorders the logic: it first handles the -EREMCHG reconnect case, then validates that a CREATE response exists and reports success, records the persistent and volatile FIDs, marks the handle open, and increments the per-tree-connection open handle counter. Only after these steps does it proceed to process the QUERY_INFO response. On any error after the handle is marked open, the common cleanup path close_cached_dir() will issue an SMB2_close for the FID, preventing the leak and the use-after-free.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.12 | 5.1 | 6.12.112 | 48958ddda3d7 |
| 6.18 | 5.1 | 6.18.55 | abab661eed00 |
| 7.2 | 5.1 | 7.2.9 | 7c1509598a4f |
| mainline | 5.1 | 7.3 | d2ff5fb93ea8 |
| cip/6.12 | 5.1 | 6.12.112-cip33 | 48958ddda3d7 |
04CIP Kernels
State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.
| CIP tree | State |
|---|---|
| cip/6.12 | Fixed in 6.12.112-cip33 |
| cip/6.1 | Affected — no CIP fix yet (latest 6.1.190-cip62) |
| cip/6.1-rt | Affected — no CIP fix yet (latest 6.1.189-cip61-rt32) |
| cip/5.10 | Affected — no CIP fix yet (latest 5.10.272-cip79) |
| cip/5.10-rt | Affected — no CIP fix yet (latest 5.10.272-cip79-rt35) |