[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20150817.122245.377868954143385043.davem@davemloft.net>
Date: Mon, 17 Aug 2015 12:22:45 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: g.nault@...halink.fr
Cc: netdev@...r.kernel.org, paulus@...ba.org
Subject: Re: [PATCH net v2] ppp: fix device unregistration upon netns
deletion
From: Guillaume Nault <g.nault@...halink.fr>
Date: Fri, 14 Aug 2015 10:42:56 +0200
> 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@...halink.fr>
> ---
> v2: remove unnecessary curly braces in idr_for_each_entry()
Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists