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


Groups > linux.kernel > #1491995

Re: [PATCH v4] net: ip, diag -- Add diag interface for raw sockets

From Cyrill Gorcunov <gorcunov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4] net: ip, diag -- Add diag interface for raw sockets
Date 2016-09-27 17:50 +0200
Message-ID <sm2NQ-2OB-35@gated-at.bofh.it> (permalink)
References <sm2b8-2BP-19@gated-at.bofh.it> <sm2NP-2OB-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Sep 27, 2016 at 08:39:59AM -0700, Eric Dumazet wrote:
...
> > +	}
> > +	if (sk && !atomic_inc_not_zero(&sk->sk_refcnt))
> > +		sk = NULL;
> 
> Minor detail, but note that raw sockets do not use rcu (yet)
> 
> Since you have read_lock(&hashinfo->lock), no writer can suddenly change
> sk->sk_refcnt to a zero value.
> 
> Therefore, a mere "sock_hold(sk)" should be enough to get a reference on
> the socket.
> 
> Using atomic_inc_not_zero() also works, but might distract/confuse the
> next guy trying to understand this code ;)

Oh, I see. Thanks Eric! I'll update the patch (hopefully tonight)
and send it out (need to finish urgent task atm).

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


Thread

[PATCH v4] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-27 17:10 +0200
  Re: [PATCH v4] net: ip, diag -- Add diag interface for raw sockets Eric Dumazet <eric.dumazet@gmail.com> - 2016-09-27 17:50 +0200
    Re: [PATCH v4] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-27 17:50 +0200

csiph-web