On Tue, 2017-11-28 at 02:23 -0800, Francesco Ruggeri wrote:
> On Mon, Nov 27, 2017 at 8:00 PM, Eric Dumazet <eric.duma...@gmail.com
> > wrote:
> > From: Eric Dumazet <eduma...@google.com>
> > 
> > 
...
> > +++ b/net/packet/af_packet.c
> > @@ -336,7 +336,7 @@ static void register_prot_hook(struct sock *sk)
> >  {
> >         struct packet_sock *po = pkt_sk(sk);
> > 
> > -       if (!po->running) {
> > +       if (!po->running && !po->frozen) {
> 
> Would it make sense to move the check for po->frozen to
> packet_notifier(NETDEV_UP)?
> As far as I can tell that is the only case today that can cause this
> race condition, and if new cases come up in the future an error code
> may be required rather than silently turning register_prot_hook()
> into
> a noop.
> Otherwise it looks fine to me.
> 

Whatever works for me is fine, I have no strong opinion on this.

Note that frozen is only set in the case we know that
register_prot_hook() is going to be called by us.

Reply via email to