CVE-2025-21677: pfcp: Destroy device along with udp socket's netns dismantle.
In the Linux kernel, the following vulnerability has been resolved:
pfcp: Destroy device along with udp socket's netns dismantle.
pfcpnewlink() links the device to a list in devnet(dev) instead of net, where a udp tunnel socket is created.
Even when net is removed, the device stays alive on devnet(dev). Then, removing net triggers the splat below. [0]
In this example, pfcp0 is created in ns2, but the udp socket is created in ns1.
ip netns add ns1 ip netns add ns2 ip -n ns1 link add netns ns2 name pfcp0 type pfcp ip netns del ns1
Let's link the device to the socket's netns instead.
Now, pfcpnetexit() needs another netdev iteration to remove all pfcp devices in the netns.
pfcpdevlist is not used under RCU, so the list API is converted to the non-RCU variant.
pfcpnetexit() can be converted to .exitbatchrtnl() in net-next.
[0]: reftracker: net notrefcnt@00000000128b34dc has 1/1 users at skalloc (./include/net/netnamespace.h:345 net/core/sock.c:2236) inetcreate (net/ipv4/afinet.c:326 net/ipv4/afinet.c:252) sockcreate (net/socket.c:1558) udpsockcreate4 (net/ipv4/udptunnelcore.c:18) pfcpcreatesock (drivers/net/pfcp.c:168) pfcpnewlink (drivers/net/pfcp.c:182 drivers/net/pfcp.c:197) rtnlnewlink (net/core/rtnetlink.c:3786 net/core/rtnetlink.c:3897 net/core/rtnetlink.c:4012) rtnetlinkrcvmsg (net/core/rtnetlink.c:6922) netlinkrcvskb (net/netlink/afnetlink.c:2542) netlinkunicast (net/netlink/afnetlink.c:1321 net/netlink/afnetlink.c:1347) netlinksendmsg (net/netlink/afnetlink.c:1891) syssendmsg (net/socket.c:711 net/socket.c:726 net/socket.c:2583) syssendmsg (net/socket.c:2639) syssendmsg (net/socket.c:2669) dosyscall64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) entrySYSCALL64afterhwframe (arch/x86/entry/entry64.S:130)
WARNING: CPU: 1 PID: 11 at lib/reftracker.c:179 reftrackerdirexit (lib/reftracker.c:179) Modules linked in: CPU: 1 UID: 0 PID: 11 Comm: kworker/u16:0 Not tainted 6.13.0-rc5-00147-g4c1224501e9d #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Workqueue: netns cleanupnet RIP: 0010:reftrackerdirexit (lib/reftracker.c:179) Code: 00 00 00 fc ff df 4d 8b 26 49 bd 00 01 00 00 00 00 ad de 4c 39 f5 0f 85 df 00 00 00 48 8b 74 24 08 48 89 df e8 a5 cc 12 02 90 <0f> 0b 90 48 8d 6b 44 be 04 00 00 00 48 89 ef e8 80 de 67 ff 48 89 RSP: 0018:ff11000007f3fb60 EFLAGS: 00010286 RAX: 00000000000020ef RBX: ff1100000d6481e0 RCX: 1ffffffff0e40d82 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8423ee3c RBP: ff1100000d648230 R08: 0000000000000001 R09: fffffbfff0e395af R10: 0000000000000001 R11: 0000000000000000 R12: ff1100000d648230 R13: dead000000000100 R14: ff1100000d648230 R15: dffffc0000000000 FS: 0000000000000000(0000) GS:ff1100006ce80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005620e1363990 CR3: 000000000eeb2002 CR4: 0000000000771ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? warn (kernel/panic.c:748) ? reftrackerdirexit (lib/reftracker.c:179) ? reportbug (lib/bug.c:201 lib/bug.c:219) ? handlebug (arch/x86/kernel/traps.c:285) ? excinvalidop (arch/x86/kernel/traps.c:309 (discriminator 1)) ? asmexcinvalidop (./arch/x86/include/asm/idtentry.h:621) ? rawspinunlockirqrestore (./arch/x86/include/asm/irqflags.h:42 ./arch/x86/include/asm/irqflags.h:97 ./arch/x86/include/asm/irqflags.h:155 ./include/linux/spinlockapismp.h:151 kernel/locking/spinlock.c:194) ? reftrackerdirexit (lib/reftracker.c:179) ? pfxreftrackerdirexit (lib/reftracker.c:158) ? kfree (mm/slub.c:4613 mm/slub.c:4761) netfree (net/core/netnamespace.c:476 net/core/netnamespace.c:467) cleanupnet (net/cor ---truncated---
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.27-1 - Upgrade
Upgrade
Linux kernel pfcpto a version that resolves this vulnerability.Fixed in 6.13.0-rc5-00147-g4c1224501e9d - Configuration
Modify pfcp so the pfcp device is linked to the udp tunnel socket's netns instead of dev_net(dev), and update pfcp_net_exit() to perform another netdev iteration to remove all pfcp devices in the netns when the netns is dismantled.
Linux kernel pfcp pfcp_net_exit() device removal during udp socket netns dismantle = Destroy pfcp device along with udp socket's netns dismantle (link pfcp device to socket's netns; ensure pfcp_net_exit() performs another netdev iteration to remove all pfcp devices in the netns)
Event History
Frequently Asked Questions
What is the severity of CVE-2025-21677?
CVE-2025-21677 is considered a medium severity vulnerability within the Linux kernel.
How do I fix CVE-2025-21677?
To fix CVE-2025-21677, update the Linux kernel to the latest stable version that includes the patch for this vulnerability.
What systems are affected by CVE-2025-21677?
CVE-2025-21677 affects the Linux kernel across various distributions and versions.
Is CVE-2025-21677 exploitable remotely?
CVE-2025-21677 has the potential for exploitation, depending on how the impacted systems are configured and used.
When was CVE-2025-21677 disclosed?
CVE-2025-21677 was disclosed as part of a routine security update for the Linux kernel.