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

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

From: David Miller <davem@davemloft.net>
Date: 2017-11-28 16:14:44

From: Eric Dumazet <redacted>
Date: Tue, 28 Nov 2017 08:03:30 -0800
From: Eric Dumazet <edumazet@google.com>

syzbot reported crashes [1] and provided a C repro easing bug hunting.

When/if packet_do_bind() calls __unregister_prot_hook() and releases
po->bind_lock, another thread can run packet_notifier() and process an
NETDEV_UP event.

This calls register_prot_hook() and hooks again the socket right before
first thread is able to grab again po->bind_lock.

Fixes this issue by temporarily setting po->num to 0, as suggested by
David Miller.

[1]
 ...
Fixes: 30f7ea1c2b5f ("packet: race condition in packet_bind")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <redacted>
Cc: Francesco Ruggeri <redacted>
Applied and queued up for -stable.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help