Skip to contentSkip to conversation

ethtool: propagate get_coalesce return value

PATCH Applied Heiner Kallweit 2 participants 2 messages May 23, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 net/ethtool/ioctl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/ethtool/ioctl.c +4 -1
index eeb1137a3..923e220ff 100644
@@ -1510,11 +1510,14 @@ static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev,
 						   void __user *useraddr)
 {
 	struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE };
+	int ret;
 
 	if (!dev->ethtool_ops->get_coalesce)
 		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)))
 		return -EFAULT;
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw

From: Heiner Kallweit <[email protected]>
Date: Sat, 23 May 2020 17:40:25 +0200

Quoted 5 lines

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.

Applied, thanks Heiner.