diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/ethtool.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 2bf565e8d0b..2ab0a60046a 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -95,18 +95,6 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data) | ||
99 | { | ||
100 | unsigned char len = dev->addr_len; | ||
101 | if ( addr->size < len ) | ||
102 | return -ETOOSMALL; | ||
103 | |||
104 | addr->size = len; | ||
105 | memcpy(data, dev->perm_addr, len); | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | |||
110 | u32 ethtool_op_get_ufo(struct net_device *dev) | 98 | u32 ethtool_op_get_ufo(struct net_device *dev) |
111 | { | 99 | { |
112 | return (dev->features & NETIF_F_UFO) != 0; | 100 | return (dev->features & NETIF_F_UFO) != 0; |
@@ -779,34 +767,20 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) | |||
779 | static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) | 767 | static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) |
780 | { | 768 | { |
781 | struct ethtool_perm_addr epaddr; | 769 | struct ethtool_perm_addr epaddr; |
782 | u8 *data; | ||
783 | int ret; | ||
784 | |||
785 | if (!dev->ethtool_ops->get_perm_addr) | ||
786 | return -EOPNOTSUPP; | ||
787 | 770 | ||
788 | if (copy_from_user(&epaddr,useraddr,sizeof(epaddr))) | 771 | if (copy_from_user(&epaddr, useraddr, sizeof(epaddr))) |
789 | return -EFAULT; | 772 | return -EFAULT; |
790 | 773 | ||
791 | data = kmalloc(epaddr.size, GFP_USER); | 774 | if (epaddr.size < dev->addr_len) |
792 | if (!data) | 775 | return -ETOOSMALL; |
793 | return -ENOMEM; | 776 | epaddr.size = dev->addr_len; |
794 | |||
795 | ret = dev->ethtool_ops->get_perm_addr(dev,&epaddr,data); | ||
796 | if (ret) | ||
797 | return ret; | ||
798 | 777 | ||
799 | ret = -EFAULT; | ||
800 | if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) | 778 | if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) |
801 | goto out; | 779 | return -EFAULT; |
802 | useraddr += sizeof(epaddr); | 780 | useraddr += sizeof(epaddr); |
803 | if (copy_to_user(useraddr, data, epaddr.size)) | 781 | if (copy_to_user(useraddr, dev->perm_addr, epaddr.size)) |
804 | goto out; | 782 | return -EFAULT; |
805 | ret = 0; | 783 | return 0; |
806 | |||
807 | out: | ||
808 | kfree(data); | ||
809 | return ret; | ||
810 | } | 784 | } |
811 | 785 | ||
812 | /* The main entry point in this file. Called from net/core/dev.c */ | 786 | /* The main entry point in this file. Called from net/core/dev.c */ |
@@ -976,7 +950,6 @@ int dev_ethtool(struct ifreq *ifr) | |||
976 | 950 | ||
977 | EXPORT_SYMBOL(dev_ethtool); | 951 | EXPORT_SYMBOL(dev_ethtool); |
978 | EXPORT_SYMBOL(ethtool_op_get_link); | 952 | EXPORT_SYMBOL(ethtool_op_get_link); |
979 | EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr); | ||
980 | EXPORT_SYMBOL(ethtool_op_get_sg); | 953 | EXPORT_SYMBOL(ethtool_op_get_sg); |
981 | EXPORT_SYMBOL(ethtool_op_get_tso); | 954 | EXPORT_SYMBOL(ethtool_op_get_tso); |
982 | EXPORT_SYMBOL(ethtool_op_get_tx_csum); | 955 | EXPORT_SYMBOL(ethtool_op_get_tx_csum); |