Skip to contentSkip to conversation

ethtool: fix error handling in linkstate_prepare_data()

PATCH Applied Michal Kubecek 2 participants 2 messages Jun 24, 2020 – Jun 25, 2020

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

PATCH 1/1 ethtool: fix error handling in linkstate_prepare_data()

When getting SQI or maximum SQI value fails in linkstate_prepare_data(), we must not return without calling ethnl_ops_complete(dev) as that could result in imbalance between ethtool_ops ->begin() and ->complete() calls.

Fixes 806602191592 ("ethtool: provide UAPI for PHY Signal Quality Index (SQI)")
---
 net/ethtool/linkstate.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
net/ethtool/linkstate.c +5 -6
index 7f47ba89054e..afe5ac8a0f00 100644
@@ -78,19 +78,18 @@ static int linkstate_prepare_data(const struct ethnl_req_info *req_base,
 
 	ret = linkstate_get_sqi(dev);
 	if (ret < 0 && ret != -EOPNOTSUPP)
-		return ret;
-
+		goto out;
 	data->sqi = ret;
 
 	ret = linkstate_get_sqi_max(dev);
 	if (ret < 0 && ret != -EOPNOTSUPP)
-		return ret;
-
+		goto out;
 	data->sqi_max = ret;
 
+	ret = 0;
+out:
 	ethnl_ops_complete(dev);
-
-	return 0;
+	return ret;
 }
 
 static int linkstate_reply_size(const struct ethnl_req_info *req_base,
Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw

From: Michal Kubecek <[email protected]>
Date: Thu, 25 Jun 2020 00:09:08 +0200 (CEST)

Quoted 6 lines

When getting SQI or maximum SQI value fails in linkstate_prepare_data(), we must not return without calling ethnl_ops_complete(dev) as that could result in imbalance between ethtool_ops ->begin() and ->complete() calls.

Fixes 806602191592 ("ethtool: provide UAPI for PHY Signal Quality Index (SQI)")

Applied, thank you.