CVE-2026-53198: ksmbd: fix use-after-free of a deferred file_lock on double SMB2_CANCEL
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free of a deferred filelock on double SMB2CANCEL
A deferred byte-range lock (an SMB2LOCK that blocks) registers an async work on conn->asyncrequests via setupasyncwork(), with cancelfn = smb2removeblockedlock and cancelargv[0] pointing at the struct filelock.
When the request is cancelled, the worker frees the filelock with locksfreelock() and takes the cancelled early-exit, which "goto out"s and never reaches releaseasyncwork() -- the only site that unlinks the work from conn->asyncrequests and clears cancelfn/cancelargv. The work therefore stays matchable on asyncrequests with a live cancelfn pointing at the freed filelock, until connection teardown finally runs releaseasyncwork().
smb2cancel() fires cancelfn unconditionally with no state guard, so a second SMB2CANCEL for the same AsyncId, arriving in that window, re-runs smb2removeblockedlock() on the freed filelock -- a slab use-after-free:
BUG: KASAN: slab-use-after-free in locksdeleteblock locksdeleteblock locksdeleteblock ksmbdvfsposixlockunblock smb2removeblockedlock smb2cancel <- 2nd SMB2CANCEL fires cancelfn handleksmbdwork Allocated by ...: locksalloclock <- smb2lock Freed by ...: locksfreelock <- smb2lock (cancelled branch) ... cache filelockcache of size 192
Reproduced on mainline with KASAN by an authenticated SMB client.
Skip a work whose state is already KSMBDWORKCANCELLED so its cancel callback cannot be fired a second time.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Linux kernel (ksmbd)to a version that resolves this vulnerability.Patch ksmbd: fix use-after-free of a deferred file_lock on double SMB2_CANCEL - Compensating control
Mitigate until the fix is applied by preventing authenticated SMB clients from issuing multiple SMB2_CANCEL requests for the same AsyncId (e.g., restrict SMB access at the network/firewall to trusted hosts).
Event History
Frequently Asked Questions
What is the severity of CVE-2026-53198?
CVE-2026-53198 has a risk rating of 47, indicating a moderate severity level.
How do I fix CVE-2026-53198?
To mitigate CVE-2026-53198, ensure that your Linux kernel is updated to the latest version that addresses this vulnerability.
What type of vulnerability is CVE-2026-53198?
CVE-2026-53198 is classified as a Use After Free vulnerability.
Which software is affected by CVE-2026-53198?
CVE-2026-53198 affects the ksmbd component of the Linux kernel.
What is the impact of CVE-2026-53198?
The impact of CVE-2026-53198 may include potential remote code execution or system instability due to improper handling of file locks.