[Intel-wired-lan] [net 6/6] ice: fix memory leak in ice_vsi_setup

Brown, Aaron F aaron.f.brown at intel.com
Sat Sep 5 03:10:44 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 6/6] ice: fix memory leak in ice_vsi_setup
> From: Jacob Keller <jacob.e.keller at intel.com>
> During ice_vsi_setup, if ice_cfg_vsi_lan fails, it does not properly
> release memory associated with the VSI rings. If we had used devres
> allocations for the rings, this would be ok. However, we use kzalloc and
> kfree_rcu for these ring structures.
> Using the correct label to cleanup the rings during ice_vsi_setup
> highlights an issue in the ice_vsi_clear_rings function: it can leave
> behind stale ring pointers in the q_vectors structure.
> When releasing rings, we must also ensure that no q_vector associated
> with the VSI will point to this ring again. To resolve this, loop over
> all q_vectors and release their ring mapping. Because we are about to
> free all rings, no q_vector should remain pointing to any of the rings
> in this VSI.
> Fixes: 5513b920a4f7 ("ice: Update Tx scheduler tree for VSI multi-Tx queue
> support")
> Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
Tested-by: Aaron Brown <aaron.f.brown at intel.com>

More information about the Intel-wired-lan mailing list