From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, gal@nvidia.com,
Jakub Kicinski <kuba@kernel.org>,
andrew@lunn.ch
Subject: [PATCH net 4/6] ethtool: rss: fix indir_table and hkey leak on get_rxfh failure
Date: Fri, 22 May 2026 16:06:45 -0700 [thread overview]
Message-ID: <20260522230647.1705600-5-kuba@kernel.org> (raw)
In-Reply-To: <20260522230647.1705600-1-kuba@kernel.org>
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: 4f038a6a02d2 ("net: ethtool: Don't call .cleanup_data when prepare_data fails")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: andrew@lunn.ch
CC: gal@nvidia.com
---
| 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--git a/net/ethtool/rss.c b/net/ethtool/rss.c
index 458a4a7907e4..9fb675d29232 100644
--- a/net/ethtool/rss.c
+++ b/net/ethtool/rss.c
@@ -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;
--
2.54.0
next prev parent reply other threads:[~2026-05-22 23:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 23:06 [PATCH net 0/6] ethtool: rss: fix a handful of small bugs Jakub Kicinski
2026-05-22 23:06 ` [PATCH net 1/6] ethtool: rss: avoid modifying the RSS context response Jakub Kicinski
2026-05-22 23:06 ` [PATCH net 2/6] ethtool: rss: add missing errno on RSS context delete Jakub Kicinski
2026-05-22 23:06 ` [PATCH net 3/6] ethtool: rss: fix falsely ignoring indir table updates Jakub Kicinski
2026-05-22 23:06 ` Jakub Kicinski [this message]
2026-05-22 23:06 ` [PATCH net 5/6] ethtool: rss: fix hkey leak when indir_size is 0 Jakub Kicinski
2026-05-22 23:06 ` [PATCH net 6/6] ethtool: rss: avoid device context leak on reply-build failure Jakub Kicinski
2026-05-26 15:20 ` [PATCH net 0/6] ethtool: rss: fix a handful of small bugs patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260522230647.1705600-5-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.