aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/ethtool.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 0b531e98ec33..2bf565e8d0b3 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -3,10 +3,12 @@
3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> 3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
4 * 4 *
5 * This file is where we call all the ethtool_ops commands to get 5 * This file is where we call all the ethtool_ops commands to get
6 * the information ethtool needs. We fall back to calling do_ioctl() 6 * the information ethtool needs.
7 * for drivers which haven't been converted to ethtool_ops yet.
8 * 7 *
9 * It's GPL, stupid. 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
10 */ 12 */
11 13
12#include <linux/module.h> 14#include <linux/module.h>
@@ -821,7 +823,7 @@ int dev_ethtool(struct ifreq *ifr)
821 return -ENODEV; 823 return -ENODEV;
822 824
823 if (!dev->ethtool_ops) 825 if (!dev->ethtool_ops)
824 goto ioctl; 826 return -EOPNOTSUPP;
825 827
826 if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd))) 828 if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
827 return -EFAULT; 829 return -EFAULT;
@@ -960,7 +962,7 @@ int dev_ethtool(struct ifreq *ifr)
960 rc = ethtool_set_gso(dev, useraddr); 962 rc = ethtool_set_gso(dev, useraddr);
961 break; 963 break;
962 default: 964 default:
963 rc = -EOPNOTSUPP; 965 rc = -EOPNOTSUPP;
964 } 966 }
965 967
966 if (dev->ethtool_ops->complete) 968 if (dev->ethtool_ops->complete)
@@ -970,15 +972,6 @@ int dev_ethtool(struct ifreq *ifr)
970 netdev_features_change(dev); 972 netdev_features_change(dev);
971 973
972 return rc; 974 return rc;
973
974 ioctl:
975 /* Keep existing behaviour for the moment. */
976 if (!capable(CAP_NET_ADMIN))
977 return -EPERM;
978
979 if (dev->do_ioctl)
980 return dev->do_ioctl(dev, ifr, SIOCETHTOOL);
981 return -EOPNOTSUPP;
982} 975}
983 976
984EXPORT_SYMBOL(dev_ethtool); 977EXPORT_SYMBOL(dev_ethtool);