Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1307629

[PATCH net] phonet: properly unshare skbs in phonet_rcv()

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject [PATCH net] phonet: properly unshare skbs in phonet_rcv()
Date 2016-01-12 18:00 +0100
Message-ID <qQasy-3AC-7@gated-at.bofh.it> (permalink)
References (7 earlier) <qPVMS-2bA-17@gated-at.bofh.it> <qPWSC-2Tc-7@gated-at.bofh.it> <qPWSC-2Tc-15@gated-at.bofh.it> <qQ1pg-61J-13@gated-at.bofh.it> <qQ7XK-23e-51@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Eric Dumazet <edumazet@google.com>

Ivaylo Dimitrov reported a regression caused by commit 7866a621043f
("dev: add per net_device packet type 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 major crash.

But the root cause is that phonet_rcv() can queue skb without checking
if skb is shared or not.

Many thanks to Ivaylo Dimitrov for his help, diagnosis and tests.

Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Remi Denis-Courmont <courmisch@gmail.com>
---
 net/phonet/af_phonet.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 10d42f3220ab..f925753668a7 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -377,6 +377,10 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
 	struct sockaddr_pn sa;
 	u16 len;
 
+	skb = skb_share_check(skb, GFP_ATOMIC);
+	if (!skb)
+		return NET_RX_DROP;
+
 	/* check we have at least a full Phonet header */
 	if (!pskb_pull(skb, sizeof(struct phonethdr)))
 		goto out;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[OOPS] In __netif_receive_skb_core Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-07 19:00 +0100
  Re: [OOPS] In __netif_receive_skb_core Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-10 18:50 +0100
    Re: [OOPS] In __netif_receive_skb_core Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-10 21:30 +0100
      Re: [OOPS] In __netif_receive_skb_core Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-11 22:10 +0100
        Re: [OOPS] In __netif_receive_skb_core Salam Noureddine <noureddine@arista.com> - 2016-01-11 23:20 +0100
          Re: [OOPS] In __netif_receive_skb_core Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-12 02:00 +0100
            Re: [OOPS] In __netif_receive_skb_core Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-12 02:10 +0100
              Re: [OOPS] In __netif_receive_skb_core Salam Noureddine <noureddine@arista.com> - 2016-01-12 02:20 +0100
                Re: [OOPS] In __netif_receive_skb_core Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-12 03:30 +0100
                Re: [OOPS] In __netif_receive_skb_core Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-12 03:30 +0100
                Re: [OOPS] In __netif_receive_skb_core Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-12 08:20 +0100
                Re: [OOPS] In __netif_receive_skb_core Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-12 15:20 +0100
                [PATCH net] phonet: properly unshare skbs in phonet_rcv() Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-12 18:00 +0100
                Re: [PATCH net] phonet: properly unshare skbs in phonet_rcv() David Miller <davem@davemloft.net> - 2016-01-12 21:50 +0100
                Re: [OOPS] In __netif_receive_skb_core Salam Noureddine <noureddine@arista.com> - 2016-01-12 19:20 +0100

csiph-web