• Jacob Keller's avatar
    ice: fix memory leak if register_netdev_fails · 135f4b9e
    Jacob Keller authored
    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: 3a858ba3 ("ice: Add support for VSI allocation and deallocation")
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    135f4b9e
ice_lib.h 2.87 KB