Thread (23 messages) 23 messages, 7 authors, 2015-12-03

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

From: Hannes Frederic Sowa <hidden>
Date: 2015-12-01 13:13:22
Also in: lkml

On Tue, Dec 1, 2015, at 14:05, Eric Dumazet wrote:
On Tue, 2015-12-01 at 12:11 +0100, Hannes Frederic Sowa wrote:
quoted
Hi Eric,

On Mon, Nov 30, 2015, at 04:37, Eric Dumazet wrote:
quoted
-                       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.
Ah, sorry, maybe I missed it. Just reviewed the patches after a longer
weekend here.

The rest looked fine to me:

Acked-by: Hannes Frederic Sowa <redacted>

Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help