Received: with ECARTIS (v1.0.0; list netdev); Thu, 19 May 2005 12:36:18 -0700 (PDT) Received: from sunset.davemloft.net (dsl027-180-168.sfo1.dsl.speakeasy.net [216.27.180.168]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id j4JJaDF3018655 for ; Thu, 19 May 2005 12:36:13 -0700 Received: from localhost ([127.0.0.1] ident=davem) by sunset.davemloft.net with esmtp (Exim 4.50) id 1DYqnr-0000eC-0c; Thu, 19 May 2005 12:35:31 -0700 Date: Thu, 19 May 2005 12:35:30 -0700 (PDT) Message-Id: <20050519.123530.55508893.davem@davemloft.net> To: herbert@gondor.apana.org.au Cc: johnpol@2ka.mipt.ru, netdev@oss.sgi.com Subject: Re: [IPV4/IPV6] Keep wmem accounting separate in ip*_push_pending_frames From: "David S. Miller" In-Reply-To: <20050516010058.GA20704@gondor.apana.org.au> References: <20050515235913.GA20242@gondor.apana.org.au> <20050515.173944.122590923.davem@davemloft.net> <20050516010058.GA20704@gondor.apana.org.au> X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 1389 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: davem@davemloft.net Precedence: bulk X-list: netdev Content-Length: 1633 Lines: 67 From: Herbert Xu Date: Mon, 16 May 2005 11:00:58 +1000 [ For other readers, Herbert and I are discussing ip_ct_gather_frags(). ] > On Sun, May 15, 2005 at 05:39:44PM -0700, David S. Miller wrote: > > > > This code should therefore just skb_orphan(), and nothing > > more. Right? > > Ideally we should move the ownership to the head skb here as well. > However, doing this would cause havoc when you have nasty users > sending fragments from two different sockets :) > > So let's stick with just the skb_orphan. Ok, based upon this I am adding the following patch to my tree. Thanks. --- 1/net/ipv4/netfilter/ip_conntrack_core.c.~1~ 2005-05-18 22:45:26.000000000 -0700 +++ 2/net/ipv4/netfilter/ip_conntrack_core.c 2005-05-19 12:32:26.000000000 -0700 @@ -940,37 +940,25 @@ struct sk_buff * ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user) { - struct sock *sk = skb->sk; #ifdef CONFIG_NETFILTER_DEBUG unsigned int olddebug = skb->nf_debug; #endif - if (sk) { - sock_hold(sk); - skb_orphan(skb); - } + skb_orphan(skb); local_bh_disable(); skb = ip_defrag(skb, user); local_bh_enable(); - if (!skb) { - if (sk) - sock_put(sk); - return skb; - } - - if (sk) { - skb_set_owner_w(skb, sk); - sock_put(sk); - } - - ip_send_check(skb->nh.iph); - skb->nfcache |= NFC_ALTERED; + if (skb) { + ip_send_check(skb->nh.iph); + skb->nfcache |= NFC_ALTERED; #ifdef CONFIG_NETFILTER_DEBUG - /* Packet path as if nothing had happened. */ - skb->nf_debug = olddebug; + /* Packet path as if nothing had happened. */ + skb->nf_debug = olddebug; #endif + } + return skb; }