[Intel-wired-lan] [net 5/6] ice: fix memory leak if register_netdev_fails

Brown, Aaron F aaron.f.brown at intel.com
Sat Sep 5 03:13:23 UTC 2020


> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Wednesday, September 2, 2020 8:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [net 5/6] ice: fix memory leak if
> register_netdev_fails
> 
> From: Jacob Keller <jacob.e.keller at intel.com>
> 
> The ice_setup_pf_sw function can cause a memory leak if register_netdev
> fails, due to accidentally failing to free the VSI rings. Fix the memory
> leak by using ice_vsi_release, ensuring we actually go through the full
> teardown process.
> 
> This should be safe even if the netdevice is not registered because we
> will have set the netdev pointer to NULL, ensuring ice_vsi_release won't
> call unregister_netdev.
> 
> An alternative fix would be moving management of the PF VSI netdev into
> the main VSI setup code. This is complicated and likely requires
> significant refactor in how we manage VSIs
> 
> Fixes: 3a858ba392c3 ("ice: Add support for VSI allocation and deallocation")
> Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c  |  6 +++---
>  drivers/net/ethernet/intel/ice/ice_lib.h  |  6 ------
>  drivers/net/ethernet/intel/ice/ice_main.c | 13 +++----------
>  3 files changed, 6 insertions(+), 19 deletions(-)
> 
Tested-by: Aaron Brown <aaron.f.brown at intel.com>


More information about the Intel-wired-lan mailing list