* [PATCH net] hinic: fix leak of ethtool RSS user configuration buffers
@ 2026-07-20 9:11 Chenguang Zhao
2026-07-20 13:01 ` Joe Damato
0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-07-20 9:11 UTC (permalink / raw)
To: cai.huoqing, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, chenguang.zhao, Chenguang Zhao
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] hinic: fix leak of ethtool RSS user configuration buffers
2026-07-20 9:11 [PATCH net] hinic: fix leak of ethtool RSS user configuration buffers Chenguang Zhao
@ 2026-07-20 13:01 ` Joe Damato
0 siblings, 0 replies; 2+ messages in thread
From: Joe Damato @ 2026-07-20 13:01 UTC (permalink / raw)
To: Chenguang Zhao
Cc: cai.huoqing, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Chenguang Zhao
On Mon, Jul 20, 2026 at 05:11:02PM +0800, Chenguang Zhao wrote:
> 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);
> +
I scanned the code and ... maybe I got this wrong ... but it looks like
nothing actually uses these fields?
If you look at hinic_ethtool.c, the buffers are allocated, data is copied into
them and then they are never used. hinic_get_rxfh seems to read the state
directly from the device ?
I wonder if the correct fix is to drop the buffers and the memcpys entirely
because they seem unnecessary and unused.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-20 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 9:11 [PATCH net] hinic: fix leak of ethtool RSS user configuration buffers Chenguang Zhao
2026-07-20 13:01 ` Joe Damato
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox