CVE-2026-31718: ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger

Published May 1, 2026
·
Updated

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

6 affected components
Linux Linux kernel
Linux Linux kernel>=6.6.32<6.7
Linux Linux kernel>=6.9<6.12.84
Linux Linux kernel>=6.13<6.18.25
Linux Linux kernel>=6.19<7.0.2
Linux Linux kernel=7.1-rc1

Event History

May 1, 2026
CVE Published
via MITRE·01:56 PM
Data Sourced
via MITRE·01:56 PM
DescriptionSeverity
Data Sourced
via NVD·02:16 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

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.

2

What does CVE-2026-31718 affect?

CVE-2026-31718 affects the Linux kernel, particularly the ksmbd module responsible for handling SMB requests.

3

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.

4

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.

5

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.

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