Skip to content

Commit 95fcb69

Browse files
iveceragregkh
authored andcommitted
ethtool: fix error paths in ethnl_set_channels()
[ Upstream commit ef72cd3 ] Fix two error paths in ethnl_set_channels() to avoid lock-up caused but unreleased RTNL. Fixes: e19c591 ("ethtool: set device channel counts with CHANNELS_SET request") Reported-by: LiLiang <liali@redhat.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Michal Kubecek <mkubecek@suse.cz> Link: https://lore.kernel.org/r/20201215090810.801777-1-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent aeab3d7 commit 95fcb69

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎net/ethtool/channels.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,19 @@ int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info)
194194
if (netif_is_rxfh_configured(dev) &&
195195
!ethtool_get_max_rxfh_channel(dev, &max_rx_in_use) &&
196196
(channels.combined_count + channels.rx_count) <= max_rx_in_use) {
197+
ret = -EINVAL;
197198
GENL_SET_ERR_MSG(info, "requested channel counts are too low for existing indirection table settings");
198-
return -EINVAL;
199+
goto out_ops;
199200
}
200201

201202
/* Disabling channels, query zero-copy AF_XDP sockets */
202203
from_channel = channels.combined_count +
203204
min(channels.rx_count, channels.tx_count);
204205
for (i = from_channel; i < old_total; i++)
205206
if (xsk_get_pool_from_qid(dev, i)) {
207+
ret = -EINVAL;
206208
GENL_SET_ERR_MSG(info, "requested channel counts are too low for existing zerocopy AF_XDP sockets");
207-
return -EINVAL;
209+
goto out_ops;
208210
}
209211

210212
ret = dev->ethtool_ops->set_channels(dev, &channels);

0 commit comments

Comments
 (0)