public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Daniel Borkmann <danborkmann@iogearbox.net>,
	David Miller <davem@davemloft.net>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
	maxk@qti.qualcomm.com, netdev@vger.kernel.org,
	dwmw2@infradead.org
Subject: [PATCH] tuntap: reset network header before calling skb_get_rxhash()
Date: Mon, 17 Dec 2012 06:39:20 -0800	[thread overview]
Message-ID: <1355755160.10504.25.camel@edumazet-glaptop> (raw)
In-Reply-To: <CAD6jFUTXP-XgwFeyN11bfGcbiit=aUOoP7sSm64WK+4s6tg2TQ@mail.gmail.com>

From: Eric Dumazet <edumazet@google.com>

Commit 499744209b2c (tuntap: dont use skb after netif_rx_ni(skb))
introduced another bug.

skb_get_rxhash() needs to access the network header, and it was
set for us in netif_rx_ni().

We need to reset network header or else skb_flow_dissect() behavior
is out of control.

Reported-and-tested-by: Kirill A. Shutemov <kirill@shutemov.name>
Tested-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/tun.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 255a9f5..173acf5 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1199,6 +1199,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 		skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
 	}
 
+	skb_reset_network_header(skb);
 	rxhash = skb_get_rxhash(skb);
 	netif_rx_ni(skb);
 

  reply	other threads:[~2012-12-17 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17  0:56 openconnect triggers soft lockup in __skb_get_rxhash Kirill A. Shutemov
2012-12-17  1:22 ` David Miller
2012-12-17  1:46   ` Kirill A. Shutemov
2012-12-17  4:46     ` Eric Dumazet
2012-12-17  8:11       ` Kirill A. Shutemov
2012-12-17 13:38         ` Daniel Borkmann
2012-12-17 14:39           ` Eric Dumazet [this message]
2012-12-17 20:33             ` [PATCH] tuntap: reset network header before calling skb_get_rxhash() David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355755160.10504.25.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=danborkmann@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=kirill@shutemov.name \
    --cc=maxk@qti.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox