diff options
author | Michal Kubecek <mkubecek@suse.cz> | 2020-06-25 01:09:08 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-26 02:17:16 +0300 |
commit | 1ae71d997a672739b22572cbe72d61a0eed8c42c (patch) | |
tree | 35fbaa75e149c650d646ea595de6a0a76d733bb6 /net/ethtool | |
parent | 0e00c05fa72554c86d7c7e0f538ec83bfe277c91 (diff) | |
download | linux-1ae71d997a672739b22572cbe72d61a0eed8c42c.tar.xz |
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)")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethtool')
-rw-r--r-- | net/ethtool/linkstate.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/ethtool/linkstate.c b/net/ethtool/linkstate.c index 7f47ba89054e..afe5ac8a0f00 100644 --- a/net/ethtool/linkstate.c +++ b/net/ethtool/linkstate.c @@ -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, |