From patchwork Mon Dec 17 14:39:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 206885 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D89582C0089 for ; Tue, 18 Dec 2012 01:39:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753168Ab2LQOjZ (ORCPT ); Mon, 17 Dec 2012 09:39:25 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:56330 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928Ab2LQOjY (ORCPT ); Mon, 17 Dec 2012 09:39:24 -0500 Received: by mail-pb0-f46.google.com with SMTP id wy7so4051092pbc.19 for ; Mon, 17 Dec 2012 06:39:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; bh=FyiVhJmxOD85cneY49uiuwAh1KcRlQPsRKXy0xviUeo=; b=W69FMdf6IsxzCDsHICnD9JHgA9PU+tXbn0LGJ+eUAd3gB/nUiguVlBDd+O0COmaCz0 nJsN7HEcRF1to45udWiegpz90+rqzVZG7N/xAyz0rYYvikxqDx9bl6HOHVIVvUT2qJE/ aQyaLVyfyQAs3pUnzjuzlzACkMy6b+dn7aFBiezYQbBpLyOwGFJXbkh+T1gESbRI9+VP JVqgj6lodf4HYxRVZ3Kts0oZCGSj35UhaomsoTajB+OxDjok9LwDUym8M8ltGQNu4Pcv LOB2Pzxx1SyFaD9j0IzDSlNL5J+PlgciPhGlm3L4eeSUIyK1rkXh8YP6mAIuzXjOPWrL pDWQ== Received: by 10.68.135.42 with SMTP id pp10mr43740848pbb.157.1355755164378; Mon, 17 Dec 2012 06:39:24 -0800 (PST) Received: from [172.26.55.26] ([172.26.55.26]) by mx.google.com with ESMTPS id gv9sm8298589pbc.21.2012.12.17.06.39.21 (version=SSLv3 cipher=OTHER); Mon, 17 Dec 2012 06:39:22 -0800 (PST) Subject: [PATCH] tuntap: reset network header before calling skb_get_rxhash() From: Eric Dumazet To: Daniel Borkmann , David Miller Cc: "Kirill A. Shutemov" , maxk@qti.qualcomm.com, netdev@vger.kernel.org, dwmw2@infradead.org In-Reply-To: References: <20121217005616.GA23029@shutemov.name> <20121216.172214.687979484434537200.davem@davemloft.net> <20121217014631.GA23101@shutemov.name> <1355719589.10504.13.camel@edumazet-glaptop> <20121217081121.GA24173@shutemov.name> Date: Mon, 17 Dec 2012 06:39:20 -0800 Message-ID: <1355755160.10504.25.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet 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 Tested-by: Daniel Borkmann Signed-off-by: Eric Dumazet --- drivers/net/tun.c | 1 + 1 file changed, 1 insertion(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);