]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: ethtool: don't ignore return from driver get_fecparam method
authorEdward Cree <ecree@solarflare.com>
Wed, 28 Feb 2018 19:15:58 +0000 (19:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Mar 2018 02:41:06 +0000 (21:41 -0500)
If ethtool_ops->get_fecparam returns an error, pass that error on to the
 user, rather than ignoring it.

Fixes: 1a5f3da20bd9 ("net: ethtool: add support for forward error correction modes")
Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/ethtool.c

index 494e6a5d73061acd87534d636ee393555b0ed40d..3f89c76d5c24c51b889343fcdf0d94577cde7dc0 100644 (file)
@@ -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;