diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2015-08-14 10:42:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-17 21:22:20 +0200 |
commit | 8cb775bc0a34dc596837e7da03fd22c747be618b (patch) | |
tree | 976085da3c0312a219d1a479ff28280d1ad0b751 /drivers/net/ethernet | |
parent | net: phy: fix PHY_RUNNING in phy_state_machine (diff) | |
download | linux-8cb775bc0a34dc596837e7da03fd22c747be618b.tar.xz linux-8cb775bc0a34dc596837e7da03fd22c747be618b.zip |
ppp: fix device unregistration upon netns deletion
PPP devices may get automatically unregistered when their network
namespace is getting removed. This happens if the ppp control plane
daemon (e.g. pppd) exits while it is the last user of this namespace.
This leads to several races:
* ppp_exit_net() may destroy the per namespace idr (pn->units_idr)
before all file descriptors were released. Successive ppp_release()
calls may then cleanup PPP devices with ppp_shutdown_interface() and
try to use the already destroyed idr.
* Automatic device unregistration may also happen before the
ppp_release() call for that device gets executed. Once called on
the file owning the device, ppp_release() will then clean it up and
try to unregister it a second time.
To fix these issues, operations defined in ppp_shutdown_interface() are
moved to the PPP device's ndo_uninit() callback. This allows PPP
devices to be properly cleaned up by unregister_netdev() and friends.
So checking for ppp->owner is now an accurate test to decide if a PPP
device should be unregistered.
Setting ppp->owner is done in ppp_create_interface(), before device
registration, in order to avoid unprotected modification of this field.
Finally, ppp_exit_net() now starts by unregistering all remaining PPP
devices to ensure that none will get unregistered after the call to
idr_destroy().
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
0 files changed, 0 insertions, 0 deletions