RE: [PATCH net] net: libwx: fix memory leak on msix entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cc: stable@xxxxxxxxxxxxxxx

> -----Original Message-----
> From: Jiawen Wu <jiawenwu@xxxxxxxxxxxxxx>
> Sent: Tuesday, November 28, 2023 5:59 PM
> To: netdev@xxxxxxxxxxxxxxx; edumazet@xxxxxxxxxx; davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx
> Cc: mengyuanlou@xxxxxxxxxxxxx; Jiawen Wu <jiawenwu@xxxxxxxxxxxxxx>
> Subject: [PATCH net] 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.
> 
> Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
> Signed-off-by: Jiawen Wu <jiawenwu@xxxxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/wangxun/libwx/wx_lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> index 2823861e5a92..a5a50b5a8816 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> @@ -1972,11 +1972,11 @@ void wx_reset_interrupt_capability(struct wx *wx)
>  	if (!pdev->msi_enabled && !pdev->msix_enabled)
>  		return;
> 
> -	pci_free_irq_vectors(wx->pdev);
>  	if (pdev->msix_enabled) {
>  		kfree(wx->msix_entries);
>  		wx->msix_entries = NULL;
>  	}
> +	pci_free_irq_vectors(wx->pdev);
>  }
>  EXPORT_SYMBOL(wx_reset_interrupt_capability);
> 
> --
> 2.27.0
> 





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux