In the Linux kernel, the following vulnerability has been resolved:
smb: client: Fix use-after-free of network namespace.
Recently, we got a customer report that CIFS triggers oops while reconnecting to a server. [0]
The workload runs on Kubernetes, and some pods mount CIFS servers in non-root network namespaces. The problem rarely happened, but it was always while the pod was dying.
The root cause is wrong reference counting for network namespace.
CIFS uses kernel sockets, which do not hold refcnt of the netns that the socket belongs to. That means CIFS must ensure the socket is always freed before its netns; otherwise, use-after-free happens.
The repro steps are roughly:
1. mount CIFS in a non-root netns 2. drop packets from the netns 3. destroy the netns 4. unmount CIFS
We can reproduce the issue quickly with the script [1] below and see the splat [2] if CONFIG_NET_NS_REFCNT_TRACKER is enabled.
When the socket is TCP, it is hard to guarantee the netns lifetime without holding refcnt due to async timers.
Let's hold netns refcnt for each socket as done for SMC in commit 9744d2bf1976 ("smc: Fix use-after-free in tcp_write_timer_handler().").
Note that we need to move put_net() from cifs_put_tcp_session() to clean_demultiplex_info(); otherwise, __sock_create() still could touch a freed netns while cifsd tries to reconnect from cifs_demultiplex_thread().
Also, maybe_get_net() cannot be put just before __sock_create() because the code is not under RCU and there is a small chance that the same address happened to be reallocated to another netns.
[0]: CIFS: VFS: \\XXXXXXXXXXX has not responded in 15 seconds. Reconnecting... CIFS: Serverclose failed 4 times, giving up Unable to handle kernel paging request at virtual address 14de99e461f84a07 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 [14de99e461f84a07] address between user and kernel address ranges Internal error: Oops: 0000000096000004 [#1] SMP Modules linked in: cls_bpf sch_ingress nls_utf8 cifs cifs_arc4 cifs_md4 dns_resolver tcp_diag inet_diag veth xt_state xt_connmark nf_conntrack_netlink xt_nat xt_statistic xt_MASQUERADE xt_mark xt_addrtype ipt_REJECT nf_reject_ipv4 nft_chain_nat nf_nat xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_comment nft_compat nf_tables nfnetlink overlay nls_ascii nls_cp437 sunrpc vfat fat aes_ce_blk aes_ce_cipher ghash_ce sm4_ce_cipher sm4 sm3_ce sm3 sha3_ce sha512_ce sha512_arm64 sha1_ce ena button sch_fq_codel loop fuse configfs dmi_sysfs sha2_ce sha256_arm64 dm_mirror dm_region_hash dm_log dm_mod dax efivarfs CPU: 5 PID: 2690970 Comm: cifsd Not tainted 6.1.103-109.184.amzn2023.aarch64 #1 Hardware name: Amazon EC2 r7g.4xlarge/, BIOS 1.0 11/1/2018 pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : fib_rules_lookup+0x44/0x238 lr : __fib_lookup+0x64/0xbc sp : ffff8000265db790 x29: ffff8000265db790 x28: 0000000000000000 x27: 000000000000bd01 x26: 0000000000000000 x25: ffff000b4baf8000 x24: ffff00047b5e4580 x23: ffff8000265db7e0 x22: 0000000000000000 x21: ffff00047b5e4500 x20: ffff0010e3f694f8 x19: 14de99e461f849f7 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 3f92800abd010002 x11: 0000000000000001 x10: ffff0010e3f69420 x9 : ffff800008a6f294 x8 : 0000000000000000 x7 : 0000000000000006 x6 : 0000000000000000 x5 : 0000000000000001 x4 : ffff001924354280 x3 : ffff8000265db7e0 x2 : 0000000000000000 x1 : ffff0010e3f694f8 x0 : ffff00047b5e4500 Call trace: fib_rules_lookup+0x44/0x238 __fib_lookup+0x64/0xbc ip_route_output_key_hash_rcu+0x2c4/0x398 ip_route_output_key_hash+0x60/0x8c tcp_v4_connect+0x290/0x488 __inet_stream_connect+0x108/0x3d0 inet_stream_connect+0x50/0x78 kernel_connect+0x6c/0xac generic_ip_conne ---truncated---
CVSS Details
- CVSS 3.1 Base Score: 9.8
- CVSS 3.1 Vector: (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
Covered by Rapid7
| Product | Vendor Advisory | Solution File | Added | Published |
|---|---|---|---|---|
| Amazon Linux Ami 2 | — | Upgrade perfUpgrade python-perfUpgrade kernel-debuginfo-common-aarch64Upgrade perf-debuginfoUpgrade bpftoolUpgrade kernel-toolsUpgrade bpftool-debuginfoUpgrade kernel-develUpgrade kernel-debuginfoUpgrade kernel-headersUpgrade kernel-livepatch-5.10.230-223.885Upgrade kernel-livepatch-4.14.355-274.598Upgrade kernelUpgrade kernel-tools-develUpgrade kernel-livepatch-5.15.173-118.169Upgrade python-perf-debuginfoUpgrade kernel-tools-debuginfoUpgrade kernel-debuginfo-common-x86_64 | Mar 10, 2025 | Nov 21, 2024 |
| Amazon_linux_2023 | — | Upgrade perfUpgrade python3-perfUpgrade perf-debuginfoUpgrade kernel-debuginfo-common-aarch64Upgrade kernel-modules-extra-commonUpgrade kernel-toolsUpgrade kernel-develUpgrade kernel-libbpfUpgrade kernel-tools-develUpgrade kernel-tools-debuginfoUpgrade kernelUpgrade kernel-libbpf-staticUpgrade kernel-headersUpgrade kernel-livepatch-6.1.119-129.201Upgrade kernel-debuginfoUpgrade kernel-libbpf-develUpgrade kernel-debuginfo-common-x86_64Upgrade bpftoolUpgrade kernel-modules-extraUpgrade bpftool-debuginfoUpgrade python3-perf-debuginfo | Mar 27, 2025 | Nov 21, 2024 |
| Debian | — | Upgrade linux | May 15, 2025 | Nov 21, 2024 |
| Huawei Euleros 2_0_sp10 | — | Upgrade kernel-abi-stablelistsUpgrade kernel-toolsUpgrade kernelUpgrade python3-perfUpgrade kernel-tools-libs | Mar 18, 2025 | Nov 21, 2024 |
| Huawei Euleros 2_0_sp11 | — | Upgrade kernel-tools-libsUpgrade bpftoolUpgrade kernel-toolsUpgrade kernelUpgrade python3-perfUpgrade kernel-abi-stablelists | Feb 11, 2025 | Nov 21, 2024 |
| Huawei Euleros 2_0_sp12 | — | Upgrade kernel-abi-stablelistsUpgrade kernelUpgrade kernel-toolsUpgrade python3-perfUpgrade kernel-tools-libsUpgrade bpftool | Feb 11, 2025 | Nov 21, 2024 |
| Huawei Euleros 2_0_sp9 | — | Upgrade kernelUpgrade kernel-tools-libsUpgrade kernel-toolsUpgrade python3-perf | Mar 18, 2025 | Nov 21, 2024 |
| Redhat_linux | — | Upgrade kernel-rtNo solution existsUpgrade kernel | May 15, 2025 | Nov 21, 2024 |
| Ubuntu | — | Upgrade linux-image-6.8.0-1027-azure-fdeUpgrade linux-image-nvidia-lowlatency-64kUpgrade linux-image-gcpUpgrade linux-image-azure-fdeUpgrade linux-image-oracleUpgrade linux-image-6.8.0-1010-gkeopUpgrade linux-image-6.8.0-1024-oracle-64kUpgrade linux-image-generic-64k-hwe-24.04Upgrade linux-image-6.11.0-1015-oemUpgrade linux-image-oem-24.04aUpgrade linux-image-6.8.0-58-lowlatency-64kUpgrade linux-image-nvidia-64k-6.8Upgrade linux-image-virtual-hwe-24.04Upgrade linux-image-oem-22.04dUpgrade linux-image-6.8.0-1028-raspiUpgrade linux-image-oracle-64kUpgrade linux-image-generic-hwe-24.04Upgrade linux-image-gcp-64kUpgrade linux-image-6.8.0-1014-azure-nvidiaUpgrade linux-image-raspi-realtimeUpgrade linux-image-awsUpgrade linux-image-gcp-lts-24.04Upgrade linux-image-ibm-lts-24.04Upgrade linux-image-ibm-classicUpgrade linux-image-oracle-64k-lts-24.04Upgrade linux-image-6.11.0-1010-lowlatency-64kUpgrade linux-image-6.8.0-58-genericUpgrade linux-image-azure-lts-24.04Upgrade linux-image-6.8.0-58-generic-64kUpgrade linux-image-nvidia-lowlatencyUpgrade linux-image-kvmUpgrade linux-image-oem-22.04bUpgrade linux-image-6.8.0-1024-ibmUpgrade linux-image-nvidia-64kUpgrade linux-image-6.8.0-1026-oemUpgrade linux-image-6.8.0-1028-gcp-64kUpgrade linux-image-generic-hwe-22.04Upgrade linux-image-6.11.0-1011-oracleUpgrade linux-image-realtimeUpgrade linux-image-aws-lts-24.04Upgrade linux-image-azure-fde-lts-24.04Upgrade linux-image-6.8.0-1023-gkeUpgrade linux-image-6.8.0-2023-raspi-realtimeUpgrade linux-image-generic-lpaeUpgrade linux-image-gkeop-6.8Upgrade linux-image-ibmUpgrade linux-image-generic-64kUpgrade linux-image-nvidiaUpgrade linux-image-6.11.0-1009-awsUpgrade linux-image-6.8.0-1027-azureUpgrade linux-image-6.11.0-1011-oracle-64kUpgrade linux-image-lowlatencyUpgrade linux-image-6.8.0-1026-nvidia-lowlatencyUpgrade linux-image-6.11.0-1010-lowlatencyUpgrade linux-image-nvidia-6.8Upgrade linux-image-oem-22.04cUpgrade linux-image-6.8.0-1028-gcpUpgrade linux-image-realtime-hwe-24.04Upgrade linux-image-6.11.0-1009-azure-fdeUpgrade linux-image-oem-22.04Upgrade linux-image-6.11.0-1009-gcpUpgrade linux-image-6.11.0-1005-realtimeUpgrade linux-image-gkeUpgrade linux-image-raspiUpgrade linux-image-virtual-hwe-22.04Upgrade linux-image-oracle-lts-24.04Upgrade linux-image-genericUpgrade linux-image-azure-nvidiaUpgrade linux-image-oem-24.04bUpgrade linux-image-gkeopUpgrade linux-image-nvidia-64k-hwe-22.04Upgrade linux-image-lowlatency-64k-hwe-22.04Upgrade linux-image-6.11.0-1008-raspiUpgrade linux-image-oem-24.04Upgrade linux-image-lowlatency-hwe-22.04Upgrade linux-image-virtualUpgrade linux-image-6.11.0-18-generic-64kUpgrade linux-image-gcp-64k-lts-24.04Upgrade linux-image-6.8.0-58-lowlatencyUpgrade linux-image-6.8.0-1026-nvidiaUpgrade linux-image-6.8.1-1020-realtimeUpgrade linux-image-nvidia-hwe-22.04Upgrade linux-image-6.11.0-18-genericUpgrade linux-image-6.11.0-1009-azureUpgrade linux-image-6.8.0-1027-awsUpgrade linux-image-azureUpgrade linux-image-6.8.0-1026-nvidia-64kUpgrade linux-image-oem-22.04aUpgrade linux-image-lowlatency-64kUpgrade linux-image-generic-64k-hwe-22.04Upgrade linux-image-6.8.0-1024-oracleUpgrade linux-image-6.8.0-1026-nvidia-lowlatency-64k | Feb 20, 2025 | Nov 21, 2024 |
| Vmware Photon_os | — | Use 'tdnf update' to upgrade all packages to the latest version. | May 27, 2026 | Nov 21, 2024 |
Prioritise with Active Threat Intelligence
With curated Threat Intelligence, you can see which vulnerabilities truly put you at risk, prioritize what matters most, and act before attackers do.
Explore Intelligence Hub