CVE-2025-40320: smb: client: fix potential cfid UAF in smb2_query_info_compound

Published Dec 8, 2025
·
Updated

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

smb: client: fix potential cfid UAF in smb2queryinfocompound

When smb2queryinfocompound() retries, a previously allocated cfid may have been freed in the first attempt. Because cfid wasn't reset on replay, later cleanup could act on a stale pointer, leading to a potential use-after-free.

Reinitialize cfid to NULL under the replay label.

Example trace (trimmed):

refcountt: underflow; use-after-free. WARNING: CPU: 1 PID: 11224 at ../lib/refcount.c:28 refcountwarnsaturate+0x9c/0x110 [...] RIP: 0010:refcountwarnsaturate+0x9c/0x110 [...] Call Trace: <TASK> smb2queryinfocompound+0x29c/0x5c0 [cifs f90b72658819bd21c94769b6a652029a07a7172f] ? stepinto+0x10d/0x690 ? legitimizepath+0x28/0x60 smb2queryfs+0x6a/0xf0 [cifs f90b72658819bd21c94769b6a652029a07a7172f] smb311queryfs+0x12d/0x140 [cifs f90b72658819bd21c94769b6a652029a07a7172f] ? kmemcachealloc+0x18a/0x340 ? getnameflags+0x46/0x1e0 cifsstatfs+0x9f/0x2b0 [cifs f90b72658819bd21c94769b6a652029a07a7172f] statfsbydentry+0x67/0x90 vfsstatfs+0x16/0xd0 userstatfs+0x54/0xa0 dosysstatfs+0x20/0x50 dosyscall64+0x58/0x80

Affected Software

1 affected component
Linux Linux kernel (cifs)

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Update the kernel CIFS/smb client code so that cfid is reinitialized to NULL under the replay label in smb2_query_info_compound().

    Linux kernel CIFS (cifs) client cfid reset on replay = Reinitialize cfid to NULL under the replay label

Event History

Dec 8, 2025
CVE Published
via MITRE·12:46 AM
Data Sourced
via MITRE·12:46 AM
DescriptionSeverity
Data Sourced
via NVD·01:16 AM
DescriptionSeverity
Data Sourced
via Red Hat·07:10 AM
DescriptionSeverityAffected Software
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-2025-40320?

CVE-2025-40320 has been classified with a moderate severity level due to the potential for use-after-free vulnerabilities in the Linux kernel.

2

How do I fix CVE-2025-40320?

To fix CVE-2025-40320, update the Linux kernel to the latest patched version provided by your distribution.

3

What systems are affected by CVE-2025-40320?

CVE-2025-40320 affects the Linux Kernel, particularly instances using the SMB client.

4

What is the primary impact of CVE-2025-40320?

The primary impact of CVE-2025-40320 is the potential for remote code execution due to a use-after-free condition.

5

When was CVE-2025-40320 disclosed?

CVE-2025-40320 was disclosed as part of ongoing security updates to the Linux kernel.

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