Received: with ECARTIS (v1.0.0; list netdev); Sat, 14 May 2005 06:41:11 -0700 (PDT) Received: from localhost.localdomain (dea.vocord.ru [217.67.177.50]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id j4EDf5Ov017521 for ; Sat, 14 May 2005 06:41:06 -0700 Received: from localhost.localdomain (uganda [127.0.0.1]) by localhost.localdomain (8.13.1/8.13.1) with ESMTP id j4EDmZMR002804; Sat, 14 May 2005 17:48:35 +0400 Received: (from s0mbre@localhost) by localhost.localdomain (8.13.1/8.13.1/Submit) id j4EDmZ3K002803; Sat, 14 May 2005 17:48:35 +0400 X-Authentication-Warning: localhost.localdomain: s0mbre set sender to johnpol@2ka.mipt.ru using -f Date: Sat, 14 May 2005 17:48:35 +0400 From: Evgeniy Polyakov To: netdev@oss.sgi.com Cc: "David S. Miller" Subject: [1/1] xfrm: skb_cow_data() does not set proper owner for new skbs. Message-ID: <20050514134834.GA2698@uganda.factory.vocord.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline User-Agent: Mutt/1.4.1i X-archive-position: 1119 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: johnpol@2ka.mipt.ru Precedence: bulk X-list: netdev Content-Length: 1099 Lines: 32 It looks like skb_cow_data() does not set proper owner for newly created skb. If we have several fragments for skb and some of them are shared(?) or cloned (like in async IPsec) there might be a situation when we require recreating skb and thus using skb_copy() for it. Newly created skb has neither a destructor nor a socket assotiated with it, which must be copied from the old skb. As far as I can see, current code sets destructor and socket for the first one skb only and uses truesize of the first skb only to increment sk_wmem_alloc value. If above "analysis" is correct then attached patch fixes that. Signed-off-by: Evgeniy Polyakov --- ./net/xfrm/xfrm_algo.c~ 2005-04-27 12:08:59.000000000 +0400 +++ ./net/xfrm/xfrm_algo.c 2005-05-14 17:36:52.000000000 +0400 @@ -698,7 +698,7 @@ return -ENOMEM; if (skb1->sk) - skb_set_owner_w(skb, skb1->sk); + skb_set_owner_w(skb2, skb1->sk); /* Looking around. Are we still alive? * OK, link new skb, drop old one */ -- Evgeniy Polyakov Crash is better than data corruption. -- Artur Grabowski