Commit 88695870 authored by Scott Feldman's avatar Scott Feldman Committed by Ralf Bächle

[PATCH] Remove CAP_NET_ADMIN check for SIOCETHTOOL's

dev_ioctl already checks capable(CAP_NET_ADMIN), so no need to do so in
drivers.
parent ada4d464
...@@ -3026,9 +3026,6 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -3026,9 +3026,6 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return 0; return 0;
case ETHTOOL_SSET: case ETHTOOL_SSET:
if(!capable(CAP_NET_ADMIN))
return -EPERM;
link = readl(&regs->GigLnkState); link = readl(&regs->GigLnkState);
if (link & LNK_1000MB) if (link & LNK_1000MB)
speed = SPEED_1000; speed = SPEED_1000;
......
...@@ -3424,10 +3424,6 @@ e100_ethtool_set_settings(struct net_device *dev, struct ifreq *ifr) ...@@ -3424,10 +3424,6 @@ e100_ethtool_set_settings(struct net_device *dev, struct ifreq *ifr)
int ethtool_new_speed_duplex; int ethtool_new_speed_duplex;
struct ethtool_cmd ecmd; struct ethtool_cmd ecmd;
if (!capable(CAP_NET_ADMIN)) {
return -EPERM;
}
bdp = dev->priv; bdp = dev->priv;
if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd))) { if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd))) {
return -EFAULT; return -EFAULT;
...@@ -3545,8 +3541,6 @@ e100_ethtool_gregs(struct net_device *dev, struct ifreq *ifr) ...@@ -3545,8 +3541,6 @@ e100_ethtool_gregs(struct net_device *dev, struct ifreq *ifr)
void *addr = ifr->ifr_data; void *addr = ifr->ifr_data;
u16 mdi_reg; u16 mdi_reg;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
bdp = dev->priv; bdp = dev->priv;
if(copy_from_user(&regs, addr, sizeof(regs))) if(copy_from_user(&regs, addr, sizeof(regs)))
...@@ -3574,9 +3568,6 @@ e100_ethtool_nway_rst(struct net_device *dev, struct ifreq *ifr) ...@@ -3574,9 +3568,6 @@ e100_ethtool_nway_rst(struct net_device *dev, struct ifreq *ifr)
{ {
struct e100_private *bdp; struct e100_private *bdp;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
bdp = dev->priv; bdp = dev->priv;
if ((bdp->speed_duplex_caps & SUPPORTED_Autoneg) && if ((bdp->speed_duplex_caps & SUPPORTED_Autoneg) &&
...@@ -3632,9 +3623,6 @@ e100_ethtool_eeprom(struct net_device *dev, struct ifreq *ifr) ...@@ -3632,9 +3623,6 @@ e100_ethtool_eeprom(struct net_device *dev, struct ifreq *ifr)
void *ptr; void *ptr;
u8 *eeprom_data_bytes = (u8 *)eeprom_data; u8 *eeprom_data_bytes = (u8 *)eeprom_data;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
bdp = dev->priv; bdp = dev->priv;
if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd))) if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd)))
...@@ -3912,9 +3900,6 @@ e100_ethtool_wol(struct net_device *dev, struct ifreq *ifr) ...@@ -3912,9 +3900,6 @@ e100_ethtool_wol(struct net_device *dev, struct ifreq *ifr)
struct ethtool_wolinfo wolinfo; struct ethtool_wolinfo wolinfo;
int res = 0; int res = 0;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
bdp = dev->priv; bdp = dev->priv;
if (copy_from_user(&wolinfo, ifr->ifr_data, sizeof (wolinfo))) { if (copy_from_user(&wolinfo, ifr->ifr_data, sizeof (wolinfo))) {
......
...@@ -1289,8 +1289,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -1289,8 +1289,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
} }
case ETHTOOL_SSET: { case ETHTOOL_SSET: {
struct ethtool_cmd ecmd; struct ethtool_cmd ecmd;
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(copy_from_user(&ecmd, addr, sizeof(ecmd))) if(copy_from_user(&ecmd, addr, sizeof(ecmd)))
return -EFAULT; return -EFAULT;
return e1000_ethtool_sset(adapter, &ecmd); return e1000_ethtool_sset(adapter, &ecmd);
...@@ -1363,8 +1361,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -1363,8 +1361,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
return 0; return 0;
} }
case ETHTOOL_NWAY_RST: { case ETHTOOL_NWAY_RST: {
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(netif_running(netdev)) { if(netif_running(netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
...@@ -1393,8 +1389,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -1393,8 +1389,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
} }
case ETHTOOL_SWOL: { case ETHTOOL_SWOL: {
struct ethtool_wolinfo wol; struct ethtool_wolinfo wol;
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(copy_from_user(&wol, addr, sizeof(wol)) != 0) if(copy_from_user(&wol, addr, sizeof(wol)) != 0)
return -EFAULT; return -EFAULT;
return e1000_ethtool_swol(adapter, &wol); return e1000_ethtool_swol(adapter, &wol);
...@@ -1436,9 +1430,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -1436,9 +1430,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
case ETHTOOL_SEEPROM: { case ETHTOOL_SEEPROM: {
struct ethtool_eeprom eeprom; struct ethtool_eeprom eeprom;
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(copy_from_user(&eeprom, addr, sizeof(eeprom))) if(copy_from_user(&eeprom, addr, sizeof(eeprom)))
return -EFAULT; return -EFAULT;
...@@ -1470,9 +1461,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -1470,9 +1461,6 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
} test = { {ETHTOOL_TEST} }; } test = { {ETHTOOL_TEST} };
int err; int err;
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(copy_from_user(&test.eth_test, addr, sizeof(test.eth_test))) if(copy_from_user(&test.eth_test, addr, sizeof(test.eth_test)))
return -EFAULT; return -EFAULT;
......
...@@ -1844,9 +1844,6 @@ static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1844,9 +1844,6 @@ static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return -EFAULT; return -EFAULT;
return 0; return 0;
} else if (ecmd.cmd == ETHTOOL_SSET) { } else if (ecmd.cmd == ETHTOOL_SSET) {
if (!capable(CAP_NET_ADMIN))
return -EPERM;
/* Verify the settings we care about. */ /* Verify the settings we care about. */
if (ecmd.autoneg != AUTONEG_ENABLE && if (ecmd.autoneg != AUTONEG_ENABLE &&
ecmd.autoneg != AUTONEG_DISABLE) ecmd.autoneg != AUTONEG_DISABLE)
......
...@@ -448,8 +448,6 @@ ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -448,8 +448,6 @@ ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
case ETHTOOL_SSET:{ case ETHTOOL_SSET:{
struct ethtool_cmd ecmd; struct ethtool_cmd ecmd;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (copy_from_user(&ecmd, addr, sizeof (ecmd))) if (copy_from_user(&ecmd, addr, sizeof (ecmd)))
return -EFAULT; return -EFAULT;
return ixgb_ethtool_sset(adapter, &ecmd); return ixgb_ethtool_sset(adapter, &ecmd);
...@@ -482,9 +480,6 @@ ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -482,9 +480,6 @@ ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
#endif /* ETHTOOL_GREGS */ #endif /* ETHTOOL_GREGS */
case ETHTOOL_NWAY_RST:{ case ETHTOOL_NWAY_RST:{
IXGB_DBG("ETHTOOL_NWAY_RST\n"); IXGB_DBG("ETHTOOL_NWAY_RST\n");
if (!capable(CAP_NET_ADMIN))
return -EPERM;
ixgb_down(adapter); ixgb_down(adapter);
ixgb_up(adapter); ixgb_up(adapter);
...@@ -539,9 +534,6 @@ ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -539,9 +534,6 @@ ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
struct ethtool_eeprom eeprom; struct ethtool_eeprom eeprom;
IXGB_DBG("ETHTOOL_SEEPROM\n"); IXGB_DBG("ETHTOOL_SEEPROM\n");
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (copy_from_user(&eeprom, addr, sizeof (eeprom))) if (copy_from_user(&eeprom, addr, sizeof (eeprom)))
return -EFAULT; return -EFAULT;
......
...@@ -2384,9 +2384,6 @@ static int gem_ethtool_ioctl(struct net_device *dev, void *ep_user) ...@@ -2384,9 +2384,6 @@ static int gem_ethtool_ioctl(struct net_device *dev, void *ep_user)
return 0; return 0;
case ETHTOOL_SSET: case ETHTOOL_SSET:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
/* Verify the settings we care about. */ /* Verify the settings we care about. */
if (ecmd.autoneg != AUTONEG_ENABLE && if (ecmd.autoneg != AUTONEG_ENABLE &&
ecmd.autoneg != AUTONEG_DISABLE) ecmd.autoneg != AUTONEG_DISABLE)
......
...@@ -2481,9 +2481,6 @@ static int happy_meal_ioctl(struct net_device *dev, ...@@ -2481,9 +2481,6 @@ static int happy_meal_ioctl(struct net_device *dev,
return -EFAULT; return -EFAULT;
return 0; return 0;
} else if (ecmd.cmd == ETHTOOL_SSET) { } else if (ecmd.cmd == ETHTOOL_SSET) {
if (!capable(CAP_NET_ADMIN))
return -EPERM;
/* Verify the settings we care about. */ /* Verify the settings we care about. */
if (ecmd.autoneg != AUTONEG_ENABLE && if (ecmd.autoneg != AUTONEG_ENABLE &&
ecmd.autoneg != AUTONEG_DISABLE) ecmd.autoneg != AUTONEG_DISABLE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment