Skip to content

Commit b1c71d6

Browse files
edumazetgregkh
authored andcommitted
ax25: properly unshare skbs in ax25_kiss_rcv()
[ Upstream commit 8156210 ] Bernard Pidoux reported a regression apparently caused by commit c353e89 ("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 7aaed57 ("phonet: properly unshare skbs in phonet_rcv()"). Fixes: 1da177e ("Linux-2.6.12-rc2") Reported-by: Bernard Pidoux <f6bvp@free.fr> Closes: https://lore.kernel.org/netdev/1713f383-c538-4918-bc64-13b3288cd542@free.fr/ Tested-by: Bernard Pidoux <f6bvp@free.fr> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Joerg Reuter <jreuter@yaina.de> Cc: David Ranch <dranch@trinnet.net> Cc: Folkert van Heusden <folkert@vanheusden.com> Reviewed-by: Dan Cross <crossd@gmail.com> Link: https://patch.msgid.link/20250902124642.212705-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent dec6117 commit b1c71d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ax25/ax25_in.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
433433
int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
434434
struct packet_type *ptype, struct net_device *orig_dev)
435435
{
436+
skb = skb_share_check(skb, GFP_ATOMIC);
437+
if (!skb)
438+
return NET_RX_DROP;
439+
436440
skb_orphan(skb);
437441

438442
if (!net_eq(dev_net(dev), &init_net)) {

0 commit comments

Comments
 (0)