CVE-2026-31477: ksmbd: fix memory leaks and NULL deref in smb2_lock()

Published Apr 22, 2026
·
Updated

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

ksmbd: fix memory leaks and NULL deref in smb2lock()

smb2lock() has three error handling issues after listdel() detaches smblock from locklist at nocheckcl:

1) If vfslockfile() returns an unexpected error in the non-UNLOCK path, goto out leaks smblock and its flock because the out: handler only iterates locklist and rollbacklist, neither of which contains the detached smblock.

2) If vfslockfile() returns -ENOENT in the UNLOCK path, goto out leaks smblock and flock for the same reason. The error code returned to the dispatcher is also stale.

3) In the rollback path, smbflockinit() can return NULL on allocation failure. The result is dereferenced unconditionally, causing a kernel NULL pointer dereference. Add a NULL check to prevent the crash and clean up the bookkeeping; the VFS lock itself cannot be rolled back without the allocation and will be released at file or connection teardown.

Fix cases 1 and 2 by hoisting the locksfreelock()/kfree() to before the if(!rc) check in the UNLOCK branch so all exit paths share one free site, and by freeing smblock and flock before goto out in the non-UNLOCK branch. Propagate the correct error code in both cases. Fix case 3 by wrapping the VFS unlock in an if(rlock) guard and adding a NULL check for locksfreelock(rlock) in the shared cleanup.

Found via call-graph analysis using sqry.

Affected Software

14 affected components
Linux ksmbd (Linux kernel)
Linux Linux kernel>=5.15.1<6.1.168
Linux Linux kernel>=6.2<6.6.131
Linux Linux kernel>=6.7<6.12.80
Linux Linux kernel>=6.13<6.18.21
Linux Linux kernel>=6.19<6.19.11
Linux Linux kernel=5.15
Linux Linux kernel=7.0-rc1
Linux Linux kernel=7.0-rc2
Linux Linux kernel=7.0-rc3
Linux Linux kernel=7.0-rc4
Linux Linux kernel=7.0-rc5
Linux Linux kernel=7.0-rc6
Linux Linux kernel=7.0-rc7

Event History

Apr 22, 2026
CVE Published
via MITRE·01:54 PM
Data Sourced
via MITRE·01:54 PM
DescriptionSeverity
Data Sourced
via NVD·02:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Apr 23, 2026
Data Sourced
via Microsoft·08:08 AM
DescriptionSeverityWeakness
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-31477?

CVE-2026-31477 has a severity rating of 7.5, indicating a high risk level.

2

How do I fix CVE-2026-31477?

To resolve CVE-2026-31477, apply the available patch provided in the latest Linux kernel update.

3

What type of vulnerability is CVE-2026-31477?

CVE-2026-31477 is categorized as a null pointer dereference vulnerability in the Linux kernel's ksmbd.

4

Which software is affected by CVE-2026-31477?

CVE-2026-31477 affects the Linux kernel and the ksmbd module within the Linux environment.

5

What is the impact of not addressing CVE-2026-31477?

Failure to address CVE-2026-31477 could lead to memory leaks and potential denial of service in affected systems.

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