]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ice: Clear and free XLT entries on reset
authorVignesh Sridhar <vignesh.sridhar@intel.com>
Thu, 30 Jul 2020 00:19:15 +0000 (17:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:26:52 +0000 (08:26 +0200)
[ Upstream commit ec1d1d2302067e3ccbc4d0adcd36d72410933b70 ]

This fix has been added to address memory leak issues resulting from
triggering a sudden driver reset which does not allow us to follow our
normal removal flows for SW XLT entries for advanced features.

- Adding call to destroy flow profile locks when clearing SW XLT tables.

- Extraction sequence entries were not correctly cleared previously
which could cause ownership conflicts for repeated reset-replay calls.

Fixes: 31ad4e4ee1e4 ("ice: Allocate flow profile")
Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice_flex_pipe.c

index 4420fc02f7e7a5cd8c0951a33fb8913846125614..6698612048625d641ae4fa827d8a506a2e61a93d 100644 (file)
@@ -2922,6 +2922,8 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx)
                                           ICE_FLOW_ENTRY_HNDL(e));
 
                list_del(&p->l_entry);
+
+               mutex_destroy(&p->entries_lock);
                devm_kfree(ice_hw_to_dev(hw), p);
        }
        mutex_unlock(&hw->fl_profs_locks[blk_idx]);
@@ -3039,7 +3041,7 @@ void ice_clear_hw_tbls(struct ice_hw *hw)
                memset(prof_redir->t, 0,
                       prof_redir->count * sizeof(*prof_redir->t));
 
-               memset(es->t, 0, es->count * sizeof(*es->t));
+               memset(es->t, 0, es->count * sizeof(*es->t) * es->fvw);
                memset(es->ref_count, 0, es->count * sizeof(*es->ref_count));
                memset(es->written, 0, es->count * sizeof(*es->written));
        }