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, sudheer.mogilappagari@intel.com
Subject: [PATCH net 5/6] ethtool: rss: fix hkey leak when indir_size is 0
Date: Fri, 22 May 2026 16:06:46 -0700 [thread overview]
Message-ID: <20260522230647.1705600-6-kuba@kernel.org> (raw)
In-Reply-To: <20260522230647.1705600-1-kuba@kernel.org>
rss_get_data_alloc() allocates a single buffer that backs both the
indirection table and the hash key, but only assigned data->indir_table
when indir_size was nonzero. The expectation was that no driver
implements RSS without supporting indirection table but apparently
enic does just that (it's the only such in-tree driver).
enic has get_rxfh_key_size but no get_rxfh_indir_size.
data->indir_table stays as NULL, hkey gets set but rss_get_data_free()
kfree(data->indir_table) is a nop and the allocation leaks.
Always store the allocation base in data->indir_table so the free path
is unambiguous. No caller treats indir_table as a sentinel; everything
keys off indir_size.
Fixes: 7112a04664bf ("ethtool: add netlink based get rss support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: andrew@lunn.ch
CC: gal@nvidia.com
CC: sudheer.mogilappagari@intel.com
---
| 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--git a/net/ethtool/rss.c b/net/ethtool/rss.c
index 9fb675d29232..f5cf214f8f85 100644
--- a/net/ethtool/rss.c
+++ b/net/ethtool/rss.c
@@ -134,8 +134,7 @@ rss_get_data_alloc(struct net_device *dev, struct rss_reply_data *data)
if (!rss_config)
return -ENOMEM;
- if (data->indir_size)
- data->indir_table = (u32 *)rss_config;
+ data->indir_table = (u32 *)rss_config;
if (data->hkey_size)
data->hkey = rss_config + indir_bytes;
--
2.54.0
next prev parent reply other threads:[~2026-05-22 23:07 UTC|newest]
Thread overview: 7+ 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 ` [PATCH net 4/6] ethtool: rss: fix indir_table and hkey leak on get_rxfh failure Jakub Kicinski
2026-05-22 23:06 ` Jakub Kicinski [this message]
2026-05-22 23:06 ` [PATCH net 6/6] ethtool: rss: avoid device context leak on reply-build failure Jakub Kicinski
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-6-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 \
--cc=sudheer.mogilappagari@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox