mirror of https://gitee.com/openkylin/linux.git
Drivers: Staging: cxt1e1: use __dev_get_name instead of dev_get_name to find interfaces
The following call chain denotes that both do_reset() and do_del_chan() are protected under rtnl_lock. If we use __dev_get_by_name() instead of dev_get_by_name() to find interface handlers in them, this would help us avoid to change interface reference counter. dev_ioctl() rtnl_lock() dev_ifsioc() c4_ioctl() do_reset() do_del_chan() rtnl_unlock() Signed-off-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
85a5bac9cd
commit
bdffbb8e26
|
@ -770,9 +770,9 @@ do_del_chan (struct net_device *musycc_dev, void *data)
|
||||||
if (cp.channum > 999)
|
if (cp.channum > 999)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
snprintf (buf, sizeof(buf), CHANNAME "%d", cp.channum);
|
snprintf (buf, sizeof(buf), CHANNAME "%d", cp.channum);
|
||||||
if (!(dev = dev_get_by_name (&init_net, buf)))
|
dev = __dev_get_by_name(&init_net, buf);
|
||||||
return -ENOENT;
|
if (!dev)
|
||||||
dev_put (dev);
|
return -ENODEV;
|
||||||
ret = do_deluser (dev, 1);
|
ret = do_deluser (dev, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -792,19 +792,18 @@ do_reset (struct net_device *musycc_dev, void *data)
|
||||||
char buf[sizeof (CHANNAME) + 3];
|
char buf[sizeof (CHANNAME) + 3];
|
||||||
|
|
||||||
sprintf (buf, CHANNAME "%d", i);
|
sprintf (buf, CHANNAME "%d", i);
|
||||||
if (!(ndev = dev_get_by_name(&init_net, buf)))
|
ndev = __dev_get_by_name(&init_net, buf);
|
||||||
continue;
|
if (!ndev)
|
||||||
|
continue;
|
||||||
priv = dev_to_hdlc (ndev)->priv;
|
priv = dev_to_hdlc (ndev)->priv;
|
||||||
|
|
||||||
if ((unsigned long) (priv->ci) ==
|
if ((unsigned long) (priv->ci) ==
|
||||||
(unsigned long) (netdev_priv(musycc_dev)))
|
(unsigned long) (netdev_priv(musycc_dev)))
|
||||||
{
|
{
|
||||||
ndev->flags &= ~IFF_UP;
|
ndev->flags &= ~IFF_UP;
|
||||||
dev_put (ndev);
|
|
||||||
netif_stop_queue (ndev);
|
netif_stop_queue (ndev);
|
||||||
do_deluser (ndev, 1);
|
do_deluser (ndev, 1);
|
||||||
} else
|
}
|
||||||
dev_put (ndev);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue