Commit 31610711 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

ethtool: propagate get_coalesce return value

get_coalesce returns 0 or ERRNO, but the return value isn't checked.
The returned coalesce data may be invalid if an ERRNO is set,
therefore better check and propagate the return value.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0096a28
...@@ -1510,11 +1510,14 @@ static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev, ...@@ -1510,11 +1510,14 @@ static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev,
void __user *useraddr) void __user *useraddr)
{ {
struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE }; struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE };
int ret;
if (!dev->ethtool_ops->get_coalesce) if (!dev->ethtool_ops->get_coalesce)
return -EOPNOTSUPP; return -EOPNOTSUPP;
dev->ethtool_ops->get_coalesce(dev, &coalesce); ret = dev->ethtool_ops->get_coalesce(dev, &coalesce);
if (ret)
return ret;
if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment