Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280846

Re: [PATCH net] ipv6: add complete rcu protection around np->opt

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH net] ipv6: add complete rcu protection around np->opt
Date 2015-12-01 14:10 +0100
Message-ID <qASQX-1Dr-45@gated-at.bofh.it> (permalink)
References <qzLya-82k-1@gated-at.bofh.it> <qzRkd-3eL-1@gated-at.bofh.it> <qzRtU-3ig-21@gated-at.bofh.it> <qAntM-6zI-5@gated-at.bofh.it> <qAR8v-sX-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH net] ipv6: add complete rcu protection around np->opt Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-12-01 12:20 +0100
  Re: [PATCH net] ipv6: add complete rcu protection around np->opt Eric Dumazet <eric.dumazet@gmail.com> - 2015-12-01 14:10 +0100
    Re: [PATCH net] ipv6: add complete rcu protection around np->opt Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-12-01 14:20 +0100

csiph-web