Skip to content

Commit 3161071

Browse files
hkallweitdavem330
authored andcommitted
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: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c0096a2 commit 3161071

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎net/ethtool/ioctl.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,11 +1510,14 @@ static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev,
15101510
void __user *useraddr)
15111511
{
15121512
struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE };
1513+
int ret;
15131514

15141515
if (!dev->ethtool_ops->get_coalesce)
15151516
return -EOPNOTSUPP;
15161517

1517-
dev->ethtool_ops->get_coalesce(dev, &coalesce);
1518+
ret = dev->ethtool_ops->get_coalesce(dev, &coalesce);
1519+
if (ret)
1520+
return ret;
15181521

15191522
if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
15201523
return -EFAULT;

0 commit comments

Comments
 (0)