From: Chenguang Zhao <chenguang.zhao@linux.dev>
To: cai.huoqing@linux.dev, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: netdev@vger.kernel.org, chenguang.zhao@linux.dev,
Chenguang Zhao <zhaochenguang@kylinos.cn>
Subject: [PATCH net] hinic: fix leak of ethtool RSS user configuration buffers
Date: Mon, 20 Jul 2026 17:11:02 +0800 [thread overview]
Message-ID: <20260720091102.1653378-1-chenguang.zhao@linux.dev> (raw)
From: Chenguang Zhao <zhaochenguang@kylinos.cn>
rss_indir_user and rss_hkey_user are allocated in __set_rss_rxfh() when
the user configures RSS via ethtool, but hinic_remove() never frees them.
free_netdev() only releases the nic_dev structure itself, so the separately
allocated buffers are leaked on driver unload.
Free both buffers in hinic_remove() after unregister_netdev().
Fixes: 4fdc51bb4e92 ("hinic: add support for rss parameters with ethtool")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
drivers/net/ethernet/huawei/hinic/hinic_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c
index 42f4792d255b..7d9c46004bcd 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_main.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c
@@ -1433,6 +1433,9 @@ static void hinic_remove(struct pci_dev *pdev)
hinic_free_intr_coalesce(nic_dev);
+ kfree(nic_dev->rss_indir_user);
+ kfree(nic_dev->rss_hkey_user);
+
hinic_port_del_mac(nic_dev, netdev->dev_addr, 0);
hinic_hwdev_cb_unregister(nic_dev->hwdev,
--
2.25.1
next reply other threads:[~2026-07-20 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 9:11 Chenguang Zhao [this message]
2026-07-20 13:01 ` [PATCH net] hinic: fix leak of ethtool RSS user configuration buffers Joe Damato
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=20260720091102.1653378-1-chenguang.zhao@linux.dev \
--to=chenguang.zhao@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=cai.huoqing@linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhaochenguang@kylinos.cn \
/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