* [PATCH net] liquidio: Fix possible memory leak in lio_reset_queues()
@ 2026-07-27 8:02 Abdun Nihaal
2026-07-27 22:55 ` Jacob Keller
0 siblings, 1 reply; 3+ messages in thread
From: Abdun Nihaal @ 2026-07-27 8:02 UTC (permalink / raw)
To: andrew+netdev
Cc: Abdun Nihaal, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, stable
The memory allocated in lio_setup_glists() and setup_rx_oom_poll_fn() is
not freed in some of the error paths in lio_reset_queues().
Fix that by adding the corresponding free functions to the error paths.
Fixes: 4b6e326b2d34 ("liquidio: Per queue oom work queue")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
Compile tested only. Issue found using static analysis.
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
index c849e2c871a9..222ef0b661da 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
@@ -1242,15 +1242,20 @@ static int lio_reset_queues(struct net_device *netdev, uint32_t num_qs)
if (setup_rx_oom_poll_fn(netdev)) {
dev_err(&oct->pci_dev->dev, "lio_setup_rx_oom_poll_fn failed\n");
+ lio_delete_glists(lio);
return 1;
}
/* Send firmware the information about new number of queues
* if the interface is a VF or a PF that is SRIOV enabled.
*/
- if (oct->sriov_info.sriov_enabled || OCTEON_CN23XX_VF(oct))
- if (lio_send_queue_count_update(netdev, num_qs))
+ if (oct->sriov_info.sriov_enabled || OCTEON_CN23XX_VF(oct)) {
+ if (lio_send_queue_count_update(netdev, num_qs)) {
+ cleanup_rx_oom_poll_fn(netdev);
+ lio_delete_glists(lio);
return -1;
+ }
+ }
}
return 0;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] liquidio: Fix possible memory leak in lio_reset_queues()
2026-07-27 8:02 [PATCH net] liquidio: Fix possible memory leak in lio_reset_queues() Abdun Nihaal
@ 2026-07-27 22:55 ` Jacob Keller
2026-07-30 11:02 ` Paolo Abeni
0 siblings, 1 reply; 3+ messages in thread
From: Jacob Keller @ 2026-07-27 22:55 UTC (permalink / raw)
To: Abdun Nihaal, andrew+netdev
Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel, stable
On 7/27/2026 1:02 AM, Abdun Nihaal wrote:
> The memory allocated in lio_setup_glists() and setup_rx_oom_poll_fn() is
> not freed in some of the error paths in lio_reset_queues().
> Fix that by adding the corresponding free functions to the error paths.
>
> Fixes: 4b6e326b2d34 ("liquidio: Per queue oom work queue")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
> ---
> Compile tested only. Issue found using static analysis.
>
Would be nice if we had a reproduction but I suspect this is tricky to
do without some kind of fault injection.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> index c849e2c871a9..222ef0b661da 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> @@ -1242,15 +1242,20 @@ static int lio_reset_queues(struct net_device *netdev, uint32_t num_qs)
>
> if (setup_rx_oom_poll_fn(netdev)) {
> dev_err(&oct->pci_dev->dev, "lio_setup_rx_oom_poll_fn failed\n");
> + lio_delete_glists(lio);
> return 1;
> }
>
> /* Send firmware the information about new number of queues
> * if the interface is a VF or a PF that is SRIOV enabled.
> */
> - if (oct->sriov_info.sriov_enabled || OCTEON_CN23XX_VF(oct))
> - if (lio_send_queue_count_update(netdev, num_qs))
> + if (oct->sriov_info.sriov_enabled || OCTEON_CN23XX_VF(oct)) {
> + if (lio_send_queue_count_update(netdev, num_qs)) {
> + cleanup_rx_oom_poll_fn(netdev);
> + lio_delete_glists(lio);
> return -1;
> + }
> + }
> }
>
> return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] liquidio: Fix possible memory leak in lio_reset_queues()
2026-07-27 22:55 ` Jacob Keller
@ 2026-07-30 11:02 ` Paolo Abeni
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2026-07-30 11:02 UTC (permalink / raw)
To: Jacob Keller, Abdun Nihaal, andrew+netdev
Cc: davem, edumazet, kuba, netdev, linux-kernel, stable
On 7/28/26 12:55 AM, Jacob Keller wrote:
> On 7/27/2026 1:02 AM, Abdun Nihaal wrote:
>> The memory allocated in lio_setup_glists() and setup_rx_oom_poll_fn() is
>> not freed in some of the error paths in lio_reset_queues().
>> Fix that by adding the corresponding free functions to the error paths.
>>
>> Fixes: 4b6e326b2d34 ("liquidio: Per queue oom work queue")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
>> ---
>> Compile tested only. Issue found using static analysis.
>>
>
> Would be nice if we had a reproduction but I suspect this is tricky to
> do without some kind of fault injection.
We are actually requesting such info, especially for patch touching less
active device drivers.
Also sashiko has a bit to say:
https://sashiko.dev/#/patchset/20260727080258.86279-1-nihaal%40cse.iitm.ac.in
/P
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-30 11:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-27 8:02 [PATCH net] liquidio: Fix possible memory leak in lio_reset_queues() Abdun Nihaal
2026-07-27 22:55 ` Jacob Keller
2026-07-30 11:02 ` Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®