Commit 91fdb30d authored by Jiawen Wu's avatar Jiawen Wu Committed by Jakub Kicinski

net: libwx: fix memory leak on msix entry

Since pci_free_irq_vectors() set pdev->msix_enabled as 0 in the
calling of pci_msix_shutdown(), wx->msix_entries is never freed.
Reordering the lines to fix the memory leak.

Cc: stable@vger.kernel.org
Fixes: 3f703186 ("net: libwx: Add irq flow functions")
Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://lore.kernel.org/r/20231128095928.1083292-1-jiawenwu@trustnetic.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9f74a3df
...@@ -1972,11 +1972,11 @@ void wx_reset_interrupt_capability(struct wx *wx) ...@@ -1972,11 +1972,11 @@ void wx_reset_interrupt_capability(struct wx *wx)
if (!pdev->msi_enabled && !pdev->msix_enabled) if (!pdev->msi_enabled && !pdev->msix_enabled)
return; return;
pci_free_irq_vectors(wx->pdev);
if (pdev->msix_enabled) { if (pdev->msix_enabled) {
kfree(wx->msix_entries); kfree(wx->msix_entries);
wx->msix_entries = NULL; wx->msix_entries = NULL;
} }
pci_free_irq_vectors(wx->pdev);
} }
EXPORT_SYMBOL(wx_reset_interrupt_capability); EXPORT_SYMBOL(wx_reset_interrupt_capability);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment