CVE-2026-31718: ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free in ksmbdclosefd() via durable scavenger
When a durable file handle survives session disconnect (TCP close without SMB2LOGOFF), sessionfdcheck() sets fp->conn = NULL to preserve the handle for later reconnection. However, it did not clean up the byte-range locks on fp->locklist.
Later, when the durable scavenger thread times out and calls ksmbdclosefd(NULL, fp), the lock cleanup loop did:
spinlock(&fp->conn->llistlock);
This caused a slab use-after-free because fp->conn was NULL and the original connection object had already been freed by ksmbdtcpdisconnect().
The root cause is asymmetric cleanup: lock entries (smblock->clist) were left dangling on the freed conn->locklist while fp->conn was nulled out.
To fix this issue properly, we need to handle the lifetime of smblock->clist across three paths: - Safely skip clist deletion when list is empty and fp->conn is NULL. - Remove the lock from the old connection's locklist in sessionfdcheck() - Re-add the lock to the new connection's locklist in ksmbdreopendurablefd().
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31718?
CVE-2026-31718 has been classified with a severity that indicates it poses a risk due to a use-after-free vulnerability in the Linux kernel.
What does CVE-2026-31718 affect?
CVE-2026-31718 affects the Linux kernel, particularly the ksmbd module responsible for handling SMB requests.
How do I fix CVE-2026-31718?
To fix CVE-2026-31718, you should update your Linux kernel to the latest version that includes the patch addressing this vulnerability.
Can CVE-2026-31718 lead to exploitation?
Yes, CVE-2026-31718 can potentially be exploited by attackers to execute arbitrary code, especially under specific conditions.
What is the nature of the vulnerability in CVE-2026-31718?
The nature of CVE-2026-31718 is a use-after-free issue that occurs within the __ksmbd_close_fd() function, potentially allowing unauthorized access.