aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZefan Li <lizefan@huawei.com>2013-06-26 15:29:54 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-03 11:03:23 -0700
commit72ad35befc4715ebb0d715b90f27572ef11a15e2 (patch)
tree1daacff1c7c923e36858d2ac82b6fb7728e84c86
parente2652ea43028e5409c2fd2b585dc8388a6e75bd0 (diff)
downloadkernel_samsung_aries-72ad35befc4715ebb0d715b90f27572ef11a15e2.zip
kernel_samsung_aries-72ad35befc4715ebb0d715b90f27572ef11a15e2.tar.gz
kernel_samsung_aries-72ad35befc4715ebb0d715b90f27572ef11a15e2.tar.bz2
dlci: acquire rtnl_lock before calling __dev_get_by_name()
commit 11eb2645cbf38a08ae491bf6c602eea900ec0bb5 upstream. Otherwise the net device returned can be freed at anytime. Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/wan/dlci.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 21b104d..df65aca 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -378,20 +378,24 @@ static int dlci_del(struct dlci_add *dlci)
struct net_device *master, *slave;
int err;
+ rtnl_lock();
+
/* validate slave device */
master = __dev_get_by_name(&init_net, dlci->devname);
- if (!master)
- return -ENODEV;
+ if (!master) {
+ err = -ENODEV;
+ goto out;
+ }
if (netif_running(master)) {
- return -EBUSY;
+ err = -EBUSY;
+ goto out;
}
dlp = netdev_priv(master);
slave = dlp->slave;
flp = netdev_priv(slave);
- rtnl_lock();
err = (*flp->deassoc)(slave, master);
if (!err) {
list_del(&dlp->list);
@@ -400,8 +404,8 @@ static int dlci_del(struct dlci_add *dlci)
dev_put(slave);
}
+out:
rtnl_unlock();
-
return err;
}