netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] packet: call fanout_release, while UNREGISTERING a netdev
@ 2016-10-05 14:12 Anoob Soman
  2016-10-07  0:50 ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Anoob Soman @ 2016-10-05 14:12 UTC (permalink / raw)
  To: netdev; +Cc: Anoob Soman

If a socket has FANOUT sockopt set, a new proto_hook is registered
as part of fanout_add(). When processing a NETDEV_UNREGISTER event in
af_packet, __fanout_unlink is called for all sockets, but prot_hook which was
registered as part of fanout_add is not removed. Call fanout_release, on a
NETDEV_UNREGISTER, which removes prot_hook and removes fanout from the
fanout_list.

This fixes BUG_ON(!list_empty(&dev->ptype_specific)) in netdev_run_todo()

Signed-off-by: Anoob Soman <anoob.soman@citrix.com>
---
 net/packet/af_packet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 33a4697..11db0d6 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3952,6 +3952,7 @@ static int packet_notifier(struct notifier_block *this,
 				}
 				if (msg == NETDEV_UNREGISTER) {
 					packet_cached_dev_reset(po);
+					fanout_release(sk);
 					po->ifindex = -1;
 					if (po->prot_hook.dev)
 						dev_put(po->prot_hook.dev);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-02-02 17:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05 14:12 [PATCH net] packet: call fanout_release, while UNREGISTERING a netdev Anoob Soman
2016-10-07  0:50 ` David Miller
2017-01-30 17:26   ` Eric Dumazet
2017-01-30 18:19     ` Anoob Soman
2017-01-30 19:08     ` Anoob Soman
2017-01-30 19:44       ` Eric Dumazet
2017-01-31 17:03         ` Anoob Soman
2017-01-31 18:00           ` Eric Dumazet
2017-01-31 18:14             ` Anoob Soman
2017-02-02 14:42               ` Anoob Soman
2017-02-02 15:53                 ` Eric Dumazet
2017-02-02 16:44                   ` Anoob Soman
2017-02-02 17:12                     ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).