CVE-2026-31477
Memory Leak and NULL Dereference in Linux ksmbd smb2_lock
Publication date: 2026-04-22
Last updated on: 2026-04-27
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | linux_kernel | 5.15 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | From 6.13 (inc) to 6.18.21 (exc) |
| linux | linux_kernel | From 6.19 (inc) to 6.19.11 (exc) |
| linux | linux_kernel | From 6.2 (inc) to 6.6.131 (exc) |
| linux | linux_kernel | From 6.7 (inc) to 6.12.80 (exc) |
| linux | linux_kernel | From 5.15.1 (inc) to 6.1.168 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-476 | The product dereferences a pointer that it expects to be valid but is NULL. |
Attack-Flow Graph
AI Powered Q&A
How can this vulnerability impact me? :
This vulnerability can impact you by causing memory leaks in the kernel, which may degrade system performance or stability over time. Additionally, the NULL pointer dereference can lead to a kernel crash, resulting in a denial of service (system crash or reboot). These impacts can affect the reliability and availability of systems running the vulnerable Linux kernel.
What immediate steps should I take to mitigate this vulnerability?
The vulnerability in the Linux kernel's ksmbd smb2_lock() function involves memory leaks and a potential NULL pointer dereference. Immediate mitigation steps include updating the Linux kernel to a version where this issue is fixed, as the problem arises from error handling flaws in smb2_lock() that have been corrected by proper memory management and NULL checks.
Since the vulnerability is in the kernel code, applying the official patch or upgrading to a kernel version released after 2026-04-22 that includes the fix is the recommended action.
Can you explain this vulnerability to me?
This vulnerability exists in the Linux kernel's ksmbd component, specifically in the smb2_lock() function. It involves three error handling issues that occur after detaching smb_lock from the lock_list. These issues cause memory leaks and a potential NULL pointer dereference (kernel crash) due to improper handling of locks and error codes during file locking operations.
- 1) Memory leaks occur if vfs_lock_file() returns an unexpected error in the non-UNLOCK path because the detached smb_lock and its flock are not freed.
- 2) Memory leaks also occur if vfs_lock_file() returns -ENOENT in the UNLOCK path, with an incorrect error code returned.
- 3) A NULL pointer dereference can happen in the rollback path if smb_flock_init() fails to allocate memory, leading to a kernel crash.
The fix involves properly freeing the locks in all exit paths, propagating correct error codes, and adding NULL checks to prevent crashes.