From 1109c55b54703416593be6275aeaad9aefcfe4b1 Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Wed, 23 Sep 2015 22:54:48 +0200 Subject: [PATCH] ppp: Fix circular locking dependency in ppp_create_interface() From: Guillaume Nault For more details see [1]. [1] http://marc.info/?t=144298854300001&r=1&w=2 Reported-by: Sedat Dilek Tested-by: Sedat Dilek Cc: stable@vger.kernel.org # v4.2+ Fixes: 8cb775bc0a34 ("ppp: fix device unregistration upon netns deletion") CC: Guillaume Nault CC: David S. Miller CC: netdev@vger.kernel.org" --- drivers/net/ppp/ppp_generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 0481daf9201a..ed00446759b2 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -2755,6 +2755,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit, */ dev_net_set(dev, net); + rtnl_lock(); mutex_lock(&pn->all_ppp_mutex); if (unit < 0) { @@ -2785,7 +2786,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit, ppp->file.index = unit; sprintf(dev->name, "ppp%d", unit); - ret = register_netdev(dev); + ret = register_netdevice(dev); if (ret != 0) { unit_put(&pn->units_idr, unit); netdev_err(ppp->dev, "PPP: couldn't register device %s (%d)\n", @@ -2797,6 +2798,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit, atomic_inc(&ppp_unit_count); mutex_unlock(&pn->all_ppp_mutex); + rtnl_unlock(); *retp = 0; return ppp; -- 2.5.3