Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755522AbbLANFJ (ORCPT ); Tue, 1 Dec 2015 08:05:09 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:36208 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755401AbbLANFD (ORCPT ); Tue, 1 Dec 2015 08:05:03 -0500 Message-ID: <1448975100.25582.9.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH net] ipv6: add complete rcu protection around np->opt From: Eric Dumazet To: Hannes Frederic Sowa Cc: Dmitry Vyukov , Vlad Yasevich , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev , LKML , Eric Dumazet , William Dauchy , Rainer Weikusat , syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin Date: Tue, 01 Dec 2015 05:05:00 -0800 In-Reply-To: <1448968286.3318880.454548345.76FA2174@webmail.messagingengine.com> References: <1448730683.24696.94.camel@edumazet-glaptop2.roam.corp.google.com> <1448731434.24696.97.camel@edumazet-glaptop2.roam.corp.google.com> <1448854677.24696.117.camel@edumazet-glaptop2.roam.corp.google.com> <1448968286.3318880.454548345.76FA2174@webmail.messagingengine.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1303 Lines: 42 On Tue, 2015-12-01 at 12:11 +0100, Hannes Frederic Sowa wrote: > Hi Eric, > > On Mon, Nov 30, 2015, at 04:37, Eric Dumazet wrote: > > - opt = xchg(&np->opt, NULL); > > - if (opt) > > - sock_kfree_s(sk, opt, opt->tot_len); > > + opt = xchg((__force struct ipv6_txoptions > > **)&np->opt, > > + NULL); > > + if (opt) { > > + atomic_sub(opt->tot_len, > > &sk->sk_omem_alloc); > > + txopt_put(opt); > > + } > > pktopt = xchg(&np->pktoptions, NULL); > > kfree_skb(pktopt); > > Is here something special going on (because of the xchg). I don't see > why you cannot simply use a RCU_INIT_POINTER? > > Thanks, > Hannes Yes, I mentioned this earlier, and will be addressed in net-next tree later. (Same for np->pktoptions) The xchg() here does not bring additional protection as we are the last user of np. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/