aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25/ax25_in.c
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2025-09-02 12:46:42 +0000
committerJakub Kicinski <[email protected]>2025-09-04 00:06:30 +0000
commit8156210d36a43e76372312c87eb5ea3dbb405a85 (patch)
tree8dfaffc31f53e369edfe449c646bbd85c5fbdb35 /net/ax25/ax25_in.c
parentmctp: return -ENOPROTOOPT for unknown getsockopt options (diff)
downloadkernel-8156210d36a43e76372312c87eb5ea3dbb405a85.tar.gz
kernel-8156210d36a43e76372312c87eb5ea3dbb405a85.zip
ax25: properly unshare skbs in ax25_kiss_rcv()
Bernard Pidoux reported a regression apparently caused by commit c353e8983e0d ("net: introduce per netns packet chains"). skb->dev becomes NULL and we crash in __netif_receive_skb_core(). Before above commit, different kind of bugs or corruptions could happen without a major crash. But the root cause is that ax25_kiss_rcv() can queue/mangle input skb without checking if this skb is shared or not. Many thanks to Bernard Pidoux for his help, diagnosis and tests. We had a similar issue years ago fixed with commit 7aaed57c5c28 ("phonet: properly unshare skbs in phonet_rcv()"). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Bernard Pidoux <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Tested-by: Bernard Pidoux <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Cc: Joerg Reuter <[email protected]> Cc: David Ranch <[email protected]> Cc: Folkert van Heusden <[email protected]> Reviewed-by: Dan Cross <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/ax25/ax25_in.c')
-rw-r--r--net/ax25/ax25_in.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 1cac25aca637..f2d66af86359 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -433,6 +433,10 @@ free:
int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype, struct net_device *orig_dev)
{
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (!skb)
+ return NET_RX_DROP;
+
skb_orphan(skb);
if (!net_eq(dev_net(dev), &init_net)) {