From patchwork Mon Oct 8 19:38:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 190113 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 38C412C0314 for ; Tue, 9 Oct 2012 06:38:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752811Ab2JHTi4 (ORCPT ); Mon, 8 Oct 2012 15:38:56 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:47929 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260Ab2JHTiy (ORCPT ); Mon, 8 Oct 2012 15:38:54 -0400 Received: by mail-bk0-f46.google.com with SMTP id jk13so2246472bkc.19 for ; Mon, 08 Oct 2012 12:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=ktiSUKeFh8IuNfOUe4qBlxQKO3w8C1c7I05okBA2uyY=; b=Xhx938uQORggPjpuRX7wY1cHvWQMH+qh5y827SXiGU9C1hUeo8TXO0qZ2OH6iOOU04 L7PQ1MN2Mw4utwgZ8TKXlLHS8pZYa6OHTH0QGLsbP4n1sEr2F0oo3GimMQv7ExAPu9P1 hG5Po5POPva/fwVAy5IXtP23oxSWi+Gpvhe11waHvIF9FHyOe2zFLWWhDpDyGHxPTlRx zrr+PGy7AnwR4hFoJqBUZmJlDLrtWZcrlPCnsVvmRtmnvXC/eue8I5CuN8yzAB+YjaU7 kycuZOWfrVnbPNxwr9jlW4q9xFq9RV7Cq6SnXAdS5VhVuRypoE2wfmEWI5YHruV58QET +RsA== Received: by 10.204.9.3 with SMTP id j3mr6014895bkj.15.1349725133709; Mon, 08 Oct 2012 12:38:53 -0700 (PDT) Received: from [172.28.91.124] ([172.28.91.124]) by mx.google.com with ESMTPS id e13sm13193040bkw.12.2012.10.08.12.38.51 (version=SSLv3 cipher=OTHER); Mon, 08 Oct 2012 12:38:52 -0700 (PDT) Subject: [PATCH] ipv6: gro: fix PV6_GRO_CB(skb)->proto problem From: Eric Dumazet To: David Miller Cc: netdev , Herbert Xu Date: Mon, 08 Oct 2012 21:38:50 +0200 Message-ID: <1349725130.21172.3663.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 It seems IPV6_GRO_CB(skb)->proto can be destroyed in skb_gro_receive() if a new skb is allocated (to serve as an anchor for frag_list) We copy NAPI_GRO_CB() only (not the IPV6 specific part) in : *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); So we leave IPV6_GRO_CB(nskb)->proto to 0 (fresh skb allocation) instead of IPPROTO_TCP (6) ipv6_gro_complete() isnt able to call ops->gro_complete() [ tcp6_gro_complete() ] Fix this by moving proto in NAPI_GRO_CB() and getting rid of IPV6_GRO_CB Signed-off-by: Eric Dumazet Cc: Herbert Xu --- include/linux/netdevice.h | 3 +++ net/ipv6/af_inet6.c | 11 ++--------- 2 files changed, 5 insertions(+), 9 deletions(-) -- 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/include/linux/netdevice.h b/include/linux/netdevice.h index 0a36fff..4b9035c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1513,6 +1513,9 @@ struct napi_gro_cb { /* jiffies when first packet was created/queued */ unsigned long age; + + /* Used in ipv6_gro_receive() */ + int proto; }; #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index f757e3b..a974247 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -822,13 +822,6 @@ out: return segs; } -struct ipv6_gro_cb { - struct napi_gro_cb napi; - int proto; -}; - -#define IPV6_GRO_CB(skb) ((struct ipv6_gro_cb *)(skb)->cb) - static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, struct sk_buff *skb) { @@ -874,7 +867,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, iph = ipv6_hdr(skb); } - IPV6_GRO_CB(skb)->proto = proto; + NAPI_GRO_CB(skb)->proto = proto; flush--; nlen = skb_network_header_len(skb); @@ -930,7 +923,7 @@ static int ipv6_gro_complete(struct sk_buff *skb) sizeof(*iph)); rcu_read_lock(); - ops = rcu_dereference(inet6_protos[IPV6_GRO_CB(skb)->proto]); + ops = rcu_dereference(inet6_protos[NAPI_GRO_CB(skb)->proto]); if (WARN_ON(!ops || !ops->gro_complete)) goto out_unlock;