Thread (7 messages) flat view 7 messages, 3 authors, 2017-11-28

Re: [PATCH net] net/packet: fix a race in packet_bind() and packet_notifier()

From: Eric Dumazet <hidden>
Date: 2017-11-28 15:14:58

On Tue, 2017-11-28 at 09:48 -0500, David Miller wrote:
From: Eric Dumazet <redacted>
Date: Mon, 27 Nov 2017 20:00:52 -0800
quoted
@@ -368,9 +368,11 @@ static void __unregister_prot_hook(struct sock
*sk, bool sync)
quoted
      __sock_put(sk);
 
      if (sync) {
+             po->frozen = 1;
              spin_unlock(&po->bind_lock);
              synchronize_net();
              spin_lock(&po->bind_lock);
+             po->frozen = 0;
      }
 }
 
Ugh.

Maybe you can just set po->num to zero in the bind code path which
causes
this problem.  That will prevent this situation entirely.
Yes, I can submit a V2 with this idea implemented, 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