* [BUG] af_packet FANOUT and device dismantle
@ 2016-09-02 0:04 Eric Dumazet
2016-09-03 0:37 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2016-09-02 0:04 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Hi David
When you added fanout in commit dc99f600698dcac,
it seems a device dismantle is not properly handled.
packet_notifier() does properly finds all sockets attached to the
device and we call __unregister_prot_hook()
But the actual dev_remove_pack() is called when the last socket attached
to the FANOUT group is _closed_ , possibly minutes after the device
disappeared.
So we trigger the BUG_ON(!list_empty(&dev->ptype_all)); in
netdev_run_todo(), that came with linux-4.0 in
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7866a621043fbaca3d7389e9b9f69dd1a2e5a855
Fix would be to call dev_remote_pack() from __fanout_unlink() when
num_members becomes 0.
Let me know if you agree with this, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] af_packet FANOUT and device dismantle
2016-09-02 0:04 [BUG] af_packet FANOUT and device dismantle Eric Dumazet
@ 2016-09-03 0:37 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-09-03 0:37 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 01 Sep 2016 17:04:43 -0700
> When you added fanout in commit dc99f600698dcac,
> it seems a device dismantle is not properly handled.
>
> packet_notifier() does properly finds all sockets attached to the
> device and we call __unregister_prot_hook()
>
> But the actual dev_remove_pack() is called when the last socket attached
> to the FANOUT group is _closed_ , possibly minutes after the device
> disappeared.
>
> So we trigger the BUG_ON(!list_empty(&dev->ptype_all)); in
> netdev_run_todo(), that came with linux-4.0 in
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7866a621043fbaca3d7389e9b9f69dd1a2e5a855
>
> Fix would be to call dev_remote_pack() from __fanout_unlink() when
> num_members becomes 0.
>
> Let me know if you agree with this, thanks.
I completely agree with your analysis, good catch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-03 0:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-02 0:04 [BUG] af_packet FANOUT and device dismantle Eric Dumazet
2016-09-03 0:37 ` David Miller
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).