Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethtool: don't ignore return from driver get_fecparam method

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>

authored by

Edward Cree and committed by
David S. Miller
a6d50512 e2c0dc1f

+4 -1
+4 -1
net/core/ethtool.c
··· 2520 2520 static int ethtool_get_fecparam(struct net_device *dev, void __user *useraddr) 2521 2521 { 2522 2522 struct ethtool_fecparam fecparam = { ETHTOOL_GFECPARAM }; 2523 + int rc; 2523 2524 2524 2525 if (!dev->ethtool_ops->get_fecparam) 2525 2526 return -EOPNOTSUPP; 2526 2527 2527 - dev->ethtool_ops->get_fecparam(dev, &fecparam); 2528 + rc = dev->ethtool_ops->get_fecparam(dev, &fecparam); 2529 + if (rc) 2530 + return rc; 2528 2531 2529 2532 if (copy_to_user(useraddr, &fecparam, sizeof(fecparam))) 2530 2533 return -EFAULT;