CVE-2025-23143: net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.

Published May 1, 2025
·
Updated

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

net: Fix null-ptr-deref by socklockinitclassandname() and rmmod.

When I ran the repro [0] and waited a few seconds, I observed two LOCKDEP splats: a warning immediately followed by a null-ptr-deref. [1]

Reproduction Steps:

1) Mount CIFS 2) Add an iptables rule to drop incoming FIN packets for CIFS 3) Unmount CIFS 4) Unload the CIFS module 5) Remove the iptables rule

At step 3), the CIFS module calls sockrelease() for the underlying TCP socket, and it returns quickly. However, the socket remains in FINWAIT1 because incoming FIN packets are dropped.

At this point, the module's refcnt is 0 while the socket is still alive, so the following rmmod command succeeds.

# ss -tan State Recv-Q Send-Q Local Address:Port Peer Address:Port FIN-WAIT-1 0 477 10.0.2.15:51062 10.0.0.137:445

# lsmod | grep cifs cifs 1159168 0

This highlights a discrepancy between the lifetime of the CIFS module and the underlying TCP socket. Even after CIFS calls sockrelease() and it returns, the TCP socket does not die immediately in order to close the connection gracefully.

While this is generally fine, it causes an issue with LOCKDEP because CIFS assigns a different lock class to the TCP socket's sk->sklock using socklockinitclassandname().

Once an incoming packet is processed for the socket or a timer fires, sk->sklock is acquired.

Then, LOCKDEP checks the lock context in checkwaitcontext(), where hlockclass() is called to retrieve the lock class. However, since the module has already been unloaded, hlockclass() logs a warning and returns NULL, triggering the null-ptr-deref.

If LOCKDEP is enabled, we must ensure that a module calling socklockinitclassandname() (CIFS, NFS, etc) cannot be unloaded while such a socket is still alive to prevent this issue.

Let's hold the module reference in socklockinitclassandname() and release it when the socket is freed in skprotfree().

Note that socklockinit() clears sk->skowner for svccreatesocket() that calls socklockinitclassandname() for a listening socket, which clones a socket by skclonelock() without GFPZERO.

[0]: CIFSSERVER="10.0.0.137" CIFSPATH="//${CIFSSERVER}/Users/Administrator/Desktop/CIFSTEST" DEV="enp0s3" CRED="/root/WindowsCredential.txt"

MNT=$(mktemp -d /tmp/XXXXXX) mount -t cifs ${CIFSPATH} ${MNT} -o vers=3.0,credentials=${CRED},cache=none,echointerval=1

iptables -A INPUT -s ${CIFSSERVER} -j DROP

for i in $(seq 10); do umount ${MNT} rmmod cifs sleep 1 done

rm -r ${MNT}

iptables -D INPUT -s ${CIFSSERVER} -j DROP

[1]: DEBUGLOCKSWARNON(1) WARNING: CPU: 10 PID: 0 at kernel/locking/lockdep.c:234 hlockclass (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223) Modules linked in: cifsarc4 nlsucs2utils cifsmd4 [last unloaded: cifs] CPU: 10 UID: 0 PID: 0 Comm: swapper/10 Not tainted 6.14.0 #36 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:hlockclass (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223) ... Call Trace: <IRQ> lockacquire (kernel/locking/lockdep.c:4853 kernel/locking/lockdep.c:5178) lockacquire (kernel/locking/lockdep.c:469 kernel/locking/lockdep.c:5853 kernel/locking/lockdep.c:5816) rawspinlocknested (kernel/locking/spinlock.c:379) tcpv4rcv (./include/linux/skbuff.h:1678 ./include/net/tcp.h:2547 net/ipv4/tcpipv4.c:2350) ...

BUG: kernel NULL pointer dereference, address: 00000000000000c4 PF: supervisor read access in kernel mode PF: errorcode(0x0000) - not-present page PGD 0 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 10 UID: 0 PID: 0 Comm: swapper/10 Tainted: G W 6.14.0 #36 Tainted: [W]=WARN Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:lockacquire (kernel/ ---truncated---

Affected Software

13 affected componentsFixes available
Linux Linux kernel
Linux Linux kernel>=2.6.20<5.4.300
Linux Linux kernel>=5.5<5.10.245
Linux Linux kernel>=5.11<5.15.194
Linux Linux kernel>=5.16<6.1.153
Linux Linux kernel>=6.2<6.6.107
Linux Linux kernel>=6.7<6.12.24
Linux Linux kernel>=6.13<6.13.12
Linux Linux kernel>=6.14<6.14.3
Linux Linux kernel=6.15-rc1
Debian Debian Linux=11.0
Microsoft azl3 kernel 6.6.104.2-4
Microsoft cbl2 kernel 5.15.186.1-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Linux kernel to a version that resolves this vulnerability.

    Fixed in 6.14.0 #36Patch net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
  2. Compensating control

    Add an iptables rule to drop incoming FIN packets for CIFS (example from material: iptables -A INPUT -s ${CIFS_SERVER} -j DROP), then remove it after the test/mitigation (iptables -D INPUT -s ${CIFS_SERVER} -j DROP).

  3. Operational

    When removing the CIFS mount/module in the repro steps, avoid unloading cifs until after the socket is fully freed (the issue occurs during rmmod/cifs unload while the TCP socket is still alive). Follow the sequence: close connection gracefully, rm -r ${MNT}, then rmmod cifs, ensuring the socket is no longer alive.

Event History

May 1, 2025
CVE Published
via MITRE·12:55 PM
Data Sourced
via MITRE·12:55 PM
Description
Data Sourced
via NVD·01:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Nov 7, 2025
Data Sourced
via Microsoft·09:01 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·09:01 AM
Affected Software
Updated
via Microsoft·09:01 AM
Affected Software
Updated
via Microsoft·09:01 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2025-23143?

CVE-2025-23143 has a severity rating that indicates a potential for a null pointer dereference leading to system instability.

2

How do I fix CVE-2025-23143?

To fix CVE-2025-23143, update to the latest version of the Linux kernel that resolves this vulnerability.

3

What impact does CVE-2025-23143 have on Linux systems?

CVE-2025-23143 may cause crashes or unresponsive behavior in systems running affected versions of the Linux kernel.

4

Which versions of the Linux kernel are affected by CVE-2025-23143?

CVE-2025-23143 affects Linux kernel versions from 2.6.20 through to 6.14.3, among others specified.

5

Is CVE-2025-23143 related to any specific Linux distributions?

Yes, CVE-2025-23143 impacts various Linux distributions that utilize affected versions of 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