net: qualcomm: rmnet: restore skb->dev on deaggregated frames
Subsystems (3)
PATCH v2 1/1 net: qualcomm: rmnet: restore skb->dev on deaggregated frames
rmnet_map_deaggregate() allocates each sub-frame with alloc_skb() and leaves skb->dev NULL. __rmnet_map_ingress_handler() assigns skb->dev = ep->egress_dev only on the data path, but a MAP command frame is dispatched to rmnet_map_command() before that, so rmnet_map_send_ack() runs netif_tx_lock(skb->dev) on a NULL device. An unprivileged user reaches this by unsharing a user+net namespace, creating an rmnet link over a tap device with INGRESS_DEAGGREGATION and INGRESS_MAP_COMMANDS, and writing an aggregated frame carrying a flow-control command to the tap fd.
Restore the assignment dropped by 378e25357ac7, so every skb leaving rmnet_map_deaggregate() has a valid device.
BUG: KASAN: null-ptr-deref in _raw_spin_lock (kernel/locking/spinlock.c:158) Write of size 4 at addr 00000000000004b4 by task exploit/144 Call Trace: _raw_spin_lock (kernel/locking/spinlock.c:158) netif_tx_lock (net/sched/sch_generic.c:497) rmnet_map_command (drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c:67) rmnet_rx_handler (drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:125) __netif_receive_skb_core.constprop.0 (net/core/dev.c:6103) ... __netif_receive_skb_one_core (net/core/dev.c:6214) netif_receive_skb (net/core/dev.c:6474) tun_get_user (drivers/net/tun.c:1966) tun_chr_write_iter (drivers/net/tun.c:2012) vfs_write (fs/read_write.c:687) ksys_write (fs/read_write.c:739) do_syscall_64 (arch/x86/entry/syscall_64.c:94) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) Kernel panic - not syncing: Fatal exception in interrupt
---
v2: assign in rmnet_map_deaggregate() instead of rmnet_map_command(),
thank @Eric Dumazet.
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +1 -0
@@ -394,6 +394,7 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,if (!skbn)return NULL ; + skbn->dev = skb->dev;skb_reserve (skbn,RMNET_MAP_DEAGGR_HEADROOM );skb_put (skbn, packet_len);memcpy (skbn->data, skb->data, packet_len);
Signature · 1 line
2.43.0
[email protected]
maintainerQuoted 14 lines
-----Original Message-----
From: Xiang Mei <[email protected]>
Sent: Thursday, August 20, 2026 1:53 PM
To: Subash Abhinov Kasiviswanathan <[email protected]>; Sean Tranchetti <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Xiang Mei <[email protected]>
Subject: [PATCH net v2] net: qualcomm: rmnet: restoreskb->devon deaggregated frames
Quoted 6 lines
rmnet_map_deaggregate()allocates each sub-frame withalloc_skb()and leavesskb->devNULL.__rmnet_map_ingress_handler()assignsskb->dev=ep->egress_devonly on the data path, but a MAP command frame is dispatched tormnet_map_command()before that, sormnet_map_send_ack()runsnetif_tx_lock(skb->dev)on a NULL device. An unprivileged user reaches this by unsharing a user+net namespace, creating
an
Quoted 57 lines
rmnet link over a tap device with
INGRESS_DEAGGREGATIONandINGRESS_MAP_COMMANDS, and writing an aggregated frame carrying a flow-control command to the tap fd.Restore the assignment dropped by
378e25357ac7, so every skb leavingrmnet_map_deaggregate()has a valid device.BUG: KASAN: null-ptr-deref in _raw_spin_lock (kernel/locking/spinlock.c:158) Write of size 4 at addr 00000000000004b4 by task exploit/144 Call Trace: _raw_spin_lock (kernel/locking/spinlock.c:158) netif_tx_lock (net/sched/sch_generic.c:497) rmnet_map_command(
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c:67)
rmnet_rx_handler
(drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:125)
__netif_receive_skb_core.constprop.0 (net/core/dev.c:6103)
...
__netif_receive_skb_one_core(net/core/dev.c:6214)netif_receive_skb(net/core/dev.c:6474)
tun_get_user(drivers/net/tun.c:1966)tun_chr_write_iter(drivers/net/tun.c:2012)vfs_write(fs/read_write.c:687)
ksys_write(fs/read_write.c:739)
do_syscall_64(arch/x86/entry/syscall_64.c:94)entry_SYSCALL_64_after_hwframe(arch/x86/entry/entry_64.S:121)Kernel panic - not syncing: Fatal exception in interruptFixes 378e25357ac7 ("net: qualcomm: rmnet: Remove unnecessary deviceassignment")
Reported-by [email protected]Closes:
https://lore.kernel.org/netdev/ijg79FFMfIvKJbivdJEKvTO90Q9dTvyBkJck@bu
gs.sh/T/#uAssisted-by Claude:claude-opus-4-8Signed-off-by Xiang Mei <[email protected]>---
v2: assign inrmnet_map_deaggregate()instead ofrmnet_map_command(),
thank @Eric Dumazet.drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +1
-0@@ -394,6 +394,7 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb, if (!skbn)return NULL ; + skbn->dev = skb->dev;skb_reserve (skbn,RMNET_MAP_DEAGGR_HEADROOM );skb_put (skbn, packet_len);
Quoted 3 lines
memcpy(skbn->data, skb->data, packet_len);
--
2.43.0
Reviewed-by: Subash Abhinov Kasiviswanathan
<[email protected]>
A minor point here is that the skb->dev for data packets would be first set to real_dev in rmnet_map_deaggregate() followed by the expected mux specific rmnet dev in __rmnet_map_ingress_handler() with this patchset. The v1 patch would be assigning the skb->dev for the command packets only which would prevent the unnecessary reassignment of skb->dev in case of the data packets.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Thu, 20 Aug 2026 12:52:40 -0700 you wrote:
rmnet_map_deaggregate()allocates each sub-frame withalloc_skb()and leavesskb->devNULL.__rmnet_map_ingress_handler()assignsskb->dev=ep->egress_devonly on the data path, but a MAP command frame is dispatched tormnet_map_command()before that, sormnet_map_send_ack()runsnetif_tx_lock(skb->dev)on a NULL device. An unprivileged user reaches this by unsharing a user+net namespace, creating an rmnet link over a tap device withINGRESS_DEAGGREGATIONandINGRESS_MAP_COMMANDS, and writing an aggregated frame carrying a flow-control command to the tap fd.[...]
Here is the summary with links:
- [net,v2] net: qualcomm: rmnet: restore skb->dev on deaggregated frames
https://git.kernel.org/netdev/net/c/a66734a1c5e3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html