CVE-2025-23143 net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- No known exploitation · automatable: no · technical impact: partial
- Technology
- Linux KernelUbuntuDebian
Description
In the Linux kernel, the following vulnerability has been resolved:
net: Fix null-ptr-deref by sock_lock_init_class_and_name() 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:
- Mount CIFS
- Add an iptables rule to drop incoming FIN packets for CIFS
- Unmount CIFS
- Unload the CIFS module
- Remove the iptables rule
At step 3), the CIFS module calls sock_release() for the underlying
TCP socket, and it returns quickly. However, the socket remains in
FIN_WAIT_1 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 sock_release()
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->sk_lock
using sock_lock_init_class_and_name().
Once an incoming packet is processed for the socket or a timer fires,
sk->sk_lock is acquired.
Then, LOCKDEP checks the lock context in check_wait_context(), where
hlock_class() is called to retrieve the lock class. However, since
the module has already been unloaded, hlock_class() logs a warning
and returns NULL, triggering the null-ptr-deref.
If LOCKDEP is enabled, we must ensure that a module calling
sock_lock_init_class_and_name() (CIFS, NFS, etc) cannot be unloaded
while such a socket is still alive to prevent this issue.
Let's hold the module reference in sock_lock_init_class_and_name()
and release it when the socket is freed in sk_prot_free().
Note that sock_lock_init() clears sk->sk_owner for svc_create_socket()
that calls sock_lock_init_class_and_name() for a listening socket,
which clones a socket by sk_clone_lock() without GFP_ZERO.
CIFS_PATH="//${CIFS_SERVER}/Users/Administrator/Desktop/CIFS_TEST"
DEV="enp0s3"
CRED="/root/WindowsCredential.txt"
MNT=$(mktemp -d /tmp/XXXXXX)
mount -t cifs ${CIFS_PATH} ${MNT} -o vers=3.0,credentials=${CRED},cache=none,echo_interval=1
iptables -A INPUT -s ${CIFS_SERVER} -j DROP
for i in $(seq 10);
do
umount ${MNT}
rmmod cifs
sleep 1
done
rm -r ${MNT}
iptables -D INPUT -s ${CIFS_SERVER} -j DROP
WARNING: CPU: 10 PID: 0 at kernel/locking/lockdep.c:234 hlock_class (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223)
Modules linked in: cifs_arc4 nls_ucs2_utils cifs_md4 [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:hlock_class (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223)
...
Call Trace:
<IRQ>
__lock_acquire (kernel/locking/lockdep.c:4853 kernel/locking/lockdep.c:5178)
lock_acquire (kernel/locking/lockdep.c:469 kernel/locking/lockdep.c:5853 kernel/locking/lockdep.c:5816)
_raw_spin_lock_nested (kernel/locking/spinlock.c:379)
tcp_v4_rcv (./include/linux/skbuff.h:1678 ./include/net/tcp.h:2547 net/ipv4/tcp_ipv4.c:2350)
...
BUG: kernel NULL pointer dereference, address: 00000000000000c4
PF: supervisor read access in kernel mode
PF: error_code(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:__lock_acquire (kernel/
---truncated---
Upgrade path
18 packages: 12 fixed, 5 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AB0) | >= V3.1.6; >= V3.1.7 | No fix listed | No fix yet |
| Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AC0) | >= V3.1.6; >= V3.1.7 | No fix listed | No fix yet |
| Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AB0) | >= V3.1.6; >= V3.1.7 | No fix listed | No fix yet |
| Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AC0) | >= V3.1.6; >= V3.1.7 | No fix listed | No fix yet |
| Siemens SIPLUS S7-1500 CPU 1518-4 PN/DP MFP (6AG1518-4AX00-4AC0) | >= V3.1.6; >= V3.1.7 | No fix listed | No fix yet |
| azure linux kernel(Azure Linux 3.0) | < 6.6.112.1-2 | 6.6.112.1-2 | Fixed |
| cbl-mariner kernel(CBL-Mariner 2.0) | < 5.15.200.1-1 | 5.15.200.1-1 | Fixed |
| debian/linux(Debian 12) | < 6.1.153-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +40 more | 6.1.153-1 | Fixed |
| debian/linux(Debian 13) | < 6.12.25-1 | 6.12.25-1 | Fixed |
| debian/linux(Debian 14) | < 6.12.25-1 | 6.12.25-1 | Fixed |
| Linux kernel | < 5.4.300; < 5.10.245; < 5.15.194; < 6.1.153 +24 more | 0bb2f7a1ad1f11d861f58e5ee5051c8974ff9569, 5.4.300, 5.10.245, 5.15.194, 5f7f6abd92b6c8dc8f19625ef93c3a18549ede04, 6.1.153, 6.6.107, 6.12.24, 6.13.12, 6.14.3, 6.15, 905d43b8ad2436c240f844acb3ebcc7a99b8ebf1, 83083c5fc7cf9b0f136a42f26aba60da380f3601, 2155802d3313d7b8365935c6b8d6edc0ddd7eb94, b7489b753667bc9245958a4896c9419743083c27, c11247a21aab4b50a23c8b696727d7483de2f1e1, d51e47e2ab6ef10a317d576075cf625cdbf96426, feda73ad44a5cc80f6bf796bb1099a3fe71576d4 | Fixed |
| Siemens SIMATIC CN 4100 | < V5.0 | V5.0 | Fixed |
| ubuntu/linux(Ubuntu 22.04) | < 5.15.0-170.180 | 5.15.0-170.180 | Fixed |
| ubuntu/linux(Ubuntu 24.04) | < 6.8.0-106.106 | 6.8.0-106.106 | Fixed |
| ubuntu/linux-kvm(Ubuntu 22.04) | < 5.15.0-1092.97 | 5.15.0-1092.97 | Fixed |
| ubuntu/linux-raspi(Ubuntu 22.04) | < 5.15.0-1097.100 | 5.15.0-1097.100 | Fixed |
| ubuntu/linux-raspi(Ubuntu 24.04) | < 6.8.0-1050.54 | 6.8.0-1050.54 | Fixed |
| debian linux | = 11.0 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| cbl-mariner kernel(CBL-Mariner:2.0) | < 5.15.200.1-1 | 5.15.200.1-1 |
| azure linux kernel(Azure Linux:3.0) | < 6.6.112.1-2 | 6.6.112.1-2 |
| debian/linux(Debian:12) | < 6.1.153-1 | 6.1.153-1 |
| debian/linux(Debian:12) | = 6.1.106-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.106-2 | No fix listed |
| debian/linux(Debian:12) | = 6.1.106-3 | No fix listed |
| debian/linux(Debian:12) | = 6.1.112-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.115-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.119-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.123-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.124-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.128-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.129-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.133-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.135-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.137-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.139-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.140-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.147-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.148-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.27-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.37-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.38-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.38-2 | No fix listed |
| debian/linux(Debian:12) | = 6.1.38-2~bpo11+1 | No fix listed |
Show 68 more
| Product | Affected versions | Fixed in |
|---|---|---|
| debian/linux(Debian:12) | = 6.1.38-3 | No fix listed |
| debian/linux(Debian:12) | = 6.1.38-4 | No fix listed |
| debian/linux(Debian:12) | = 6.1.38-4~bpo11+1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.52-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.55-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.55-1~bpo11+1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.64-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.66-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.67-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.69-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.69-1~bpo11+1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.76-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.76-1~bpo11+1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.82-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.85-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.90-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.90-1~bpo11+1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.94-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.94-1~bpo11+1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.98-1 | No fix listed |
| debian/linux(Debian:12) | = 6.1.99-1 | No fix listed |
| debian/linux(Debian:13) | < 6.12.25-1 | 6.12.25-1 |
| debian/linux(Debian:14) | < 6.12.25-1 | 6.12.25-1 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < 83083c5fc7cf9b0f136a42f26aba60da380f3601 | 83083c5fc7cf9b0f136a42f26aba60da380f3601 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < b7489b753667bc9245958a4896c9419743083c27 | b7489b753667bc9245958a4896c9419743083c27 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < d51e47e2ab6ef10a317d576075cf625cdbf96426 | d51e47e2ab6ef10a317d576075cf625cdbf96426 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < feda73ad44a5cc80f6bf796bb1099a3fe71576d4 | feda73ad44a5cc80f6bf796bb1099a3fe71576d4 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < 905d43b8ad2436c240f844acb3ebcc7a99b8ebf1 | 905d43b8ad2436c240f844acb3ebcc7a99b8ebf1 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < 5f7f6abd92b6c8dc8f19625ef93c3a18549ede04 | 5f7f6abd92b6c8dc8f19625ef93c3a18549ede04 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < c11247a21aab4b50a23c8b696727d7483de2f1e1 | c11247a21aab4b50a23c8b696727d7483de2f1e1 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < 2155802d3313d7b8365935c6b8d6edc0ddd7eb94 | 2155802d3313d7b8365935c6b8d6edc0ddd7eb94 |
| Linux kernel | >= ed07536ed6731775219c1df7fa26a7588753e693, < 0bb2f7a1ad1f11d861f58e5ee5051c8974ff9569 | 0bb2f7a1ad1f11d861f58e5ee5051c8974ff9569 |
| Linux kernel | = 2.6.20 | No fix listed |
| Linux kernel | < 5.4.300 | 5.4.300 |
| Linux kernel | < 5.10.245 | 5.10.245 |
| Linux kernel | < 5.15.194 | 5.15.194 |
| Linux kernel | < 6.1.153 | 6.1.153 |
| Linux kernel | < 6.6.107 | 6.6.107 |
| Linux kernel | < 6.12.24 | 6.12.24 |
| Linux kernel | < 6.13.12 | 6.13.12 |
| Linux kernel | < 6.14.3 | 6.14.3 |
| Linux kernel | < 6.15 | 6.15 |
| Siemens SIMATIC CN 4100 | < V5.0 | V5.0 |
| Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AB0) | >= V3.1.6 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AB0) | >= V3.1.7 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AC0) | >= V3.1.6 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518-4 PN/DP MFP (6ES7518-4AX00-1AC0) | >= V3.1.7 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AB0) | >= V3.1.6 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AB0) | >= V3.1.7 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AC0) | >= V3.1.6 | No fix listed |
| Siemens SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP (6ES7518-4FX00-1AC0) | >= V3.1.7 | No fix listed |
| Siemens SIPLUS S7-1500 CPU 1518-4 PN/DP MFP (6AG1518-4AX00-4AC0) | >= V3.1.6 | No fix listed |
| Siemens SIPLUS S7-1500 CPU 1518-4 PN/DP MFP (6AG1518-4AX00-4AC0) | >= V3.1.7 | No fix listed |
| ubuntu/linux(Ubuntu:22.04) | < 5.15.0-170.180 | 5.15.0-170.180 |
| ubuntu/linux-kvm(Ubuntu:22.04) | < 5.15.0-1092.97 | 5.15.0-1092.97 |
| ubuntu/linux-raspi(Ubuntu:22.04) | < 5.15.0-1097.100 | 5.15.0-1097.100 |
| ubuntu/linux(Ubuntu:24.04) | < 6.8.0-106.106 | 6.8.0-106.106 |
| ubuntu/linux-raspi(Ubuntu:24.04) | < 6.8.0-1050.54 | 6.8.0-1050.54 |
| Linux kernel | >= 2.6.20, < 5.4.300 | 5.4.300 |
| Linux kernel | >= 5.5, < 5.10.245 | 5.10.245 |
| Linux kernel | >= 5.11, < 5.15.194 | 5.15.194 |
| Linux kernel | >= 5.16, < 6.1.153 | 6.1.153 |
| Linux kernel | >= 6.2, < 6.6.107 | 6.6.107 |
| Linux kernel | >= 6.7, < 6.12.24 | 6.12.24 |
| Linux kernel | >= 6.13, < 6.13.12 | 6.13.12 |
| Linux kernel | >= 6.14, < 6.14.3 | 6.14.3 |
| Linux kernel | = 6.15-rc1 | No fix listed |
| debian linux | = 11.0 | No fix listed |
References
- MSRC Security Update Guide vendor-advisory
- CBL-Mariner Releases vendor-advisory
- Debian Security Tracker CVE-2025-23143 vendor-advisory
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- git.kernel.org patch
- lists.debian.org mailing-list third-party-advisory
- cert-portal.siemens.com
- cert-portal.siemens.com
- cert-portal.siemens.com
- Ubuntu CVE tracker vendor-advisory
- USN-7594-1 vendor-advisory
- USN-7594-2 vendor-advisory
- USN-7594-3 vendor-advisory
- USN-8033-1 vendor-advisory
- USN-8033-2 vendor-advisory
- USN-8033-3 vendor-advisory
- USN-8034-1 vendor-advisory
- USN-8033-4 vendor-advisory
- USN-8033-5 vendor-advisory
- USN-8034-2 vendor-advisory
- USN-8033-6 vendor-advisory
- USN-8033-7 vendor-advisory
- USN-8033-8 vendor-advisory
- USN-8095-1 vendor-advisory
- USN-8100-1 vendor-advisory
- USN-8095-2 vendor-advisory
- USN-8095-3 vendor-advisory
- USN-8095-4 vendor-advisory
- USN-8125-1 vendor-advisory
- USN-8126-1 vendor-advisory
- USN-8095-5 vendor-advisory
- USN-8141-1 vendor-advisory
- USN-8163-1 vendor-advisory
- USN-8165-1 vendor-advisory
- USN-8163-2 vendor-advisory
- USN-8243-1 vendor-advisory
- USN-8261-1 vendor-advisory
- www.cve.org
- ENISA EUVD EUVD-2025-13094 third-party-advisory