Skip to content

Commit f49deaa

Browse files
kuba-moodavem330
authored andcommitted
ethtool: push the rtnl_lock into dev_ethtool()
Don't take the lock in net/core/dev_ioctl.c, we'll have things to do outside rtnl_lock soon. Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c6e03db commit f49deaa

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

net/core/dev_ioctl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr,
518518

519519
case SIOCETHTOOL:
520520
dev_load(net, ifr->ifr_name);
521-
rtnl_lock();
522521
ret = dev_ethtool(net, ifr, data);
523-
rtnl_unlock();
524522
if (colon)
525523
*colon = ':';
526524
return ret;

net/ethtool/ioctl.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2700,7 +2700,8 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr)
27002700

27012701
/* The main entry point in this file. Called from net/core/dev_ioctl.c */
27022702

2703-
int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr)
2703+
static int
2704+
__dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr)
27042705
{
27052706
struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
27062707
u32 ethcmd, sub_cmd;
@@ -3000,6 +3001,17 @@ int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr)
30003001
return rc;
30013002
}
30023003

3004+
int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr)
3005+
{
3006+
int rc;
3007+
3008+
rtnl_lock();
3009+
rc = __dev_ethtool(net, ifr, useraddr);
3010+
rtnl_unlock();
3011+
3012+
return rc;
3013+
}
3014+
30033015
struct ethtool_rx_flow_key {
30043016
struct flow_dissector_key_basic basic;
30053017
union {

0 commit comments

Comments
 (0)