mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] qlcnic: fix a memory leak in __qlcnic_pci_sriov_enable()
@ 2025-03-05 10:18 Haoxiang Li
  2025-03-06 10:36 ` Paolo Abeni
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2025-03-05 10:18 UTC (permalink / raw)
  To: shshaikh, manishc, GR-Linux-NIC-Dev, andrew+netdev, davem,
	edumazet, kuba, pabeni, jiasheng
  Cc: netdev, linux-kernel, Haoxiang Li, stable

Add qlcnic_sriov_free_vlans() to free the memory allocated by
qlcnic_sriov_alloc_vlans() if qlcnic_sriov_alloc_vlans() fails.

Fixes: 60ec7fcfe768 ("qlcnic: potential dereference null pointer of rx_queue->page_ring")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
index 8dd7aa08ecfb..b8a9e0e2907e 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
@@ -598,8 +598,10 @@ static int __qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter,
 		goto del_flr_queue;
 
 	err = qlcnic_sriov_alloc_vlans(adapter);
-	if (err)
+	if (err) {
+		qlcnic_sriov_free_vlans(adapter);
 		goto del_flr_queue;
+	}
 
 	return err;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-06 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-05 10:18 [PATCH] qlcnic: fix a memory leak in __qlcnic_pci_sriov_enable() Haoxiang Li
2025-03-06 10:36 ` 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®