Commit 26629769 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

ethtool: rss: fix indir_table and hkey leak on get_rxfh failure

rss_prepare_get() allocates the indirection table and hash key buffer
via rss_get_data_alloc(), then calls ops->get_rxfh() to populate them.
If get_rxfh() fails, the function returns an error without freeing
the allocation.

Fixes: 4f038a6a ("net: ethtool: Don't call .cleanup_data when prepare_data fails")
Link: https://patch.msgid.link/20260522230647.1705600-5-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8d60141a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -170,8 +170,10 @@ rss_prepare_get(const struct rss_req_info *request, struct net_device *dev,
	rxfh.key = data->hkey;

	ret = ops->get_rxfh(dev, &rxfh);
	if (ret)
	if (ret) {
		rss_get_data_free(data);
		goto out_unlock;
	}

	data->hfunc = rxfh.hfunc;
	data->input_xfrm = rxfh.input_xfrm;