On Thu, 15 Aug 2019 20:46:01 +0200, Eric Dumazet wrote:
> On 8/15/19 6:00 PM, Davide Caratti wrote:
> 
> >  
> > +   if (net_admin) {
> > +           const struct tcp_ulp_ops *ulp_ops;
> > +
> > +           rcu_read_lock();
> > +           ulp_ops = icsk->icsk_ulp_ops;
> > +           if (ulp_ops)
> > +                   err = tcp_diag_put_ulp(skb, sk, ulp_ops);
> > +           rcu_read_unlock();
> > +           if (err)
> > +                   return err;
> > +   }
> >     return 0;  
> 
> 
> Why is rcu_read_lock() and rcu_read_unlock() used at all ?
> 
> icsk->icsk_ulp_ops does not seem to be rcu protected ?
> 
> If this was, then an rcu_dereference() would be appropriate.

Indeed it's ulp_data not ulp_ops that are protected. Davide, 
perhaps we could push the RCU lock into tls_get_info(), after all?

And tls_context has to use rcu_deference there, as Eric points out, 
plus we should probably NULL-check it.

Reply via email to