Skip to content

Commit

Permalink
net: ethtool: don't ignore return from driver get_fecparam method
Browse files Browse the repository at this point in the history
If ethtool_ops->get_fecparam returns an error, pass that error on to the
 user, rather than ignoring it.

Fixes: 1a5f3da ("net: ethtool: add support for forward error correction modes")
Signed-off-by: Edward Cree <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ecree-solarflare authored and davem330 committed Mar 2, 2018
1 parent e2c0dc1 commit a6d5051
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2520,11 +2520,14 @@ static int set_phy_tunable(struct net_device *dev, void __user *useraddr)
static int ethtool_get_fecparam(struct net_device *dev, void __user *useraddr)
{
struct ethtool_fecparam fecparam = { ETHTOOL_GFECPARAM };
int rc;

if (!dev->ethtool_ops->get_fecparam)
return -EOPNOTSUPP;

dev->ethtool_ops->get_fecparam(dev, &fecparam);
rc = dev->ethtool_ops->get_fecparam(dev, &fecparam);
if (rc)
return rc;

if (copy_to_user(useraddr, &fecparam, sizeof(fecparam)))
return -EFAULT;
Expand Down

0 comments on commit a6d5051

Please sign in to comment.