aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/ethtool.c11
-rw-r--r--net/socket.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 597732c989ca..e88b80d41f73 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -439,6 +439,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
439{ 439{
440 struct ethtool_rxnfc info; 440 struct ethtool_rxnfc info;
441 size_t info_size = sizeof(info); 441 size_t info_size = sizeof(info);
442 int rc;
442 443
443 if (!dev->ethtool_ops->set_rxnfc) 444 if (!dev->ethtool_ops->set_rxnfc)
444 return -EOPNOTSUPP; 445 return -EOPNOTSUPP;
@@ -454,7 +455,15 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
454 if (copy_from_user(&info, useraddr, info_size)) 455 if (copy_from_user(&info, useraddr, info_size))
455 return -EFAULT; 456 return -EFAULT;
456 457
457 return dev->ethtool_ops->set_rxnfc(dev, &info); 458 rc = dev->ethtool_ops->set_rxnfc(dev, &info);
459 if (rc)
460 return rc;
461
462 if (cmd == ETHTOOL_SRXCLSRLINS &&
463 copy_to_user(useraddr, &info, info_size))
464 return -EFAULT;
465
466 return 0;
458} 467}
459 468
460static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, 469static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
diff --git a/net/socket.c b/net/socket.c
index e62b4f055071..2cad581318fe 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2758,10 +2758,10 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
2758 case ETHTOOL_GRXRINGS: 2758 case ETHTOOL_GRXRINGS:
2759 case ETHTOOL_GRXCLSRLCNT: 2759 case ETHTOOL_GRXCLSRLCNT:
2760 case ETHTOOL_GRXCLSRULE: 2760 case ETHTOOL_GRXCLSRULE:
2761 case ETHTOOL_SRXCLSRLINS:
2761 convert_out = true; 2762 convert_out = true;
2762 /* fall through */ 2763 /* fall through */
2763 case ETHTOOL_SRXCLSRLDEL: 2764 case ETHTOOL_SRXCLSRLDEL:
2764 case ETHTOOL_SRXCLSRLINS:
2765 buf_size += sizeof(struct ethtool_rxnfc); 2765 buf_size += sizeof(struct ethtool_rxnfc);
2766 convert_in = true; 2766 convert_in = true;
2767 break; 2767 break;