ax25: properly unshare skbs in ax25_kiss_rcv()
Subsystems (2)
PATCH 1/1 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()").
--- net/ax25/ax25_in.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ax25/ax25_in.c +4 -0
@@ -433,6 +433,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,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)) {
Signature · 1 line
2.51.0.318.gd7df087d1a-goog
Quoted 8 lines · Eric Dumazet
Bernard Pidoux reported a regression apparently caused by commit
c353e8983e0d("net: introduce per netns packet chains").
skb->devbecomes NULL and we crash in__netif_receive_skb_core().Before above commit, different kind of bugs or corruptions could happen without a major crash.
Quoted 7 lines
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 inphonet_rcv()").
Please mention the analysis done here in the change description:
https://lore.kernel.org/linux-hams/CAEoi9W4FGoEv+2FUKs7zc=XoLuwhhLY8f8t_xQ6MgTJyzQPxXA@mail.gmail.com/#R
Quoted 32 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Reported-by Bernard Pidoux <[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 Dan Cross <[email protected]>Cc Folkert van Heusden <[email protected]>--- net/ax25/ax25_in.c | 4 ++++ 1 file changed, 4 insertions(+)net/ax25/ax25_in.c +4
-1@@ -433,6 +433,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,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)) { --2.51.0.318.gd7df087d1a-goog
Quoted 13 lines · Dan Cross
Quoted 11 lines · Eric Dumazet
Bernard Pidoux reported a regression apparently caused by commit
c353e8983e0d("net: introduce per netns packet chains").
skb->devbecomes 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.
Quoted 8 lines
Quoted 4 lines
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 inphonet_rcv()").Please mention the analysis done here in the change description:
https://lore.kernel.org/linux-hams/CAEoi9W4FGoEv+2FUKs7zc=XoLuwhhLY8f8t_xQ6MgTJyzQPxXA@mail.gmail.com/#R
I was not aware of all the long past discussions.
No need for me to respin this patch, there is the Closes: tag for this purpose.
Whoever wants to find all the details can follow it.
For this changelog, I basically copy/pasted my phonet change, as it included all the relevant information for this old bug.
Thank you.
Quoted 34 lines
Reviewed-by Dan Cross <[email protected]>Quoted 32 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Reported-by Bernard Pidoux <[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 Dan Cross <[email protected]>Cc Folkert van Heusden <[email protected]>--- net/ax25/ax25_in.c | 4 ++++ 1 file changed, 4 insertions(+)net/ax25/ax25_in.c +4
-1@@ -433,6 +433,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,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)) { --2.51.0.318.gd7df087d1a-goog
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 9 lines · On Tue, 2 Sep 2025 12:46:42 +0000 you wrote:
Bernard Pidoux reported a regression apparently caused by commit
c353e8983e0d("net: introduce per netns packet chains").
skb->devbecomes NULL and we crash in__netif_receive_skb_core().Before above commit, different kind of bugs or corruptions could happen without a major crash.
[...]
Here is the summary with links:
- [net] ax25: properly unshare skbs in ax25_kiss_rcv()
https://git.kernel.org/netdev/net/c/8156210d36a4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html