Patch "ppp: unlock all_ppp_mutex before registering device" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
ppp: unlock all_ppp_mutex before registering device
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ppp-unlock-all_ppp_mutex-before-registering-device.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Sun Jan 28 17:37:09 CET 2018
From: Guillaume Nault <[email protected]>
Date: Wed, 10 Jan 2018 16:24:45 +0100
Subject: ppp: unlock all_ppp_mutex before registering device
From: Guillaume Nault <[email protected]>
[ Upstream commit 0171c41835591e9aa2e384b703ef9a6ae367c610 ]
ppp_dev_uninit(), which is the .ndo_uninit() handler of PPP devices, needs to lock pn->all_ppp_mutex. Therefore we mustn't call register_netdevice() with pn->all_ppp_mutex already locked, or we'd deadlock in case register_netdevice() fails and calls .ndo_uninit().
Fortunately, we can unlock pn->all_ppp_mutex before calling register_netdevice(). This lock protects pn->units_idr, which isn't used in the device registration process.
However, keeping pn->all_ppp_mutex locked during device registration did ensure that no device in transient state would be published in pn->units_idr. In practice, unlocking it before calling register_netdevice() doesn't change this property: ppp_unit_register() is called with 'ppp_mutex' locked and all searches done in pn->units_idr hold this lock too.
--- drivers/net/ppp/ppp_generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ppp/ppp_generic.c +3 -2
@@ -1002,17 +1002,18 @@ static int ppp_unit_register(struct pppif (!ifname_is_set)snprintf (ppp->dev->name,IFNAMSIZ ,"ppp%i" , ppp->file.index); +mutex_unlock (&pn->all_ppp_mutex); + ret =register_netdevice (ppp->dev);if (ret <0 ) goto err_unit;atomic_inc (&ppp_unit_count); -mutex_unlock (&pn->all_ppp_mutex); -return 0 ; err_unit: +mutex_lock (&pn->all_ppp_mutex);unit_put (&pn->units_idr, ppp->file.index); err:mutex_unlock (&pn->all_ppp_mutex);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/pppoe-take-needed_headroom-of-lower-device-into-account-on-xmit.patch queue-4.9/ppp-unlock-all_ppp_mutex-before-registering-device.patch