From: Edward Cree Date: Wed, 28 Feb 2018 19:15:58 +0000 (+0000) Subject: net: ethtool: don't ignore return from driver get_fecparam method X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d9ed3aed6d83a6ff60f2e4781ae47d5b3e19619a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net: ethtool: don't ignore return from driver get_fecparam method [ Upstream commit a6d50512b4d86ecd9f5952525e454583be1c3b14 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d374a904f1b1..490eab16b04b 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -2505,11 +2505,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;