net/ice: fix removal of FDIR profile
PATCH 1/1 net/ice: fix removal of FDIR profile
The removal of FDIR profile should start from ICE_FLTR_PTYPE_NONF_IPV4_UDP.
Fixes 109e8e06249e ("net/ice: configure HW flow director rule")
Signed-off-by Wang ShougangX <[email protected]>
--- drivers/net/ice/ice_fdir_filter.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ice/ice_fdir_filter.c +6 -1
@@ -159,6 +159,10 @@ ice_fdir_prof_alloc(struct ice_hw *hw)if (!hw->fdir_prof)return -ENOMEM ; } + +/* To avoid wild pointer, unused field pointer should be NULL */ + hw->fdir_prof[ICE_FLTR_PTYPE_NONF_NONE ] =NULL ; +for (ptype =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; ptype <ICE_FLTR_PTYPE_MAX ; ptype++) {
@@ -177,6 +181,7 @@ ice_fdir_prof_alloc(struct ice_hw *hw) fltr_ptype++)rte_free (hw->fdir_prof[fltr_ptype]);rte_free (hw->fdir_prof); + hw->fdir_prof =NULL ;return -ENOMEM ; }
@@ -573,7 +578,7 @@ ice_fdir_prof_rm_all(struct ice_pf *pf) {enum ice_fltr_ptype ptype; -for (ptype =ICE_FLTR_PTYPE_NONF_NONE ; +for (ptype =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; ptype <ICE_FLTR_PTYPE_MAX ; ptype++) {ice_fdir_prof_rm (pf, ptype, false);
Signature · 1 line
2.17.1
Quoted 26 lines · Wang ShougangX
The removal of FDIR profile should start from
ICE_FLTR_PTYPE_NONF_IPV4_UDP.Fixes 109e8e06249e ("net/ice: configure HW flow director rule")Signed-off-by Wang ShougangX <[email protected]>---
drivers/net/ice/ice_fdir_filter.c| 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)drivers/net/ice/ice_fdir_filter.c +4
-0@@ -159,6 +159,10 @@ ice_fdir_prof_alloc(struct ice_hw *hw)if (!hw->fdir_prof)return -ENOMEM ; } + +/* To avoid wild pointer, unused field pointer should be NULL */ + hw->fdir_prof[ICE_FLTR_PTYPE_NONF_NONE ] =NULL ; +for (ptype =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; ptype <ICE_FLTR_PTYPE_MAX ; ptype++) {
drivers/net/ice/ice_fdir_filter.c ice_fdir_prof_alloc(struct ice_hw *hw) · line 184
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +1
-0@@ -177,6 +181,7 @@ ice_fdir_prof_alloc(struct ice_hw *hw) fltr_ptype++)rte_free (hw->fdir_prof[fltr_ptype]);rte_free (hw->fdir_prof); + hw->fdir_prof =NULL ;
Above two changes are irrelevant to this commit, you should add them into your wild pointer fix.
Besides, I'd suggest to submit your related fixes in a patchset with a cover letter for the convenience of review.
Thanks,
Xiaolong
Quoted 15 lines
drivers/net/ice/ice_fdir_filter.c +1
-1return -ENOMEM ; }@@ -573,7 +578,7 @@ ice_fdir_prof_rm_all(struct ice_pf *pf) {enum ice_fltr_ptype ptype; -for (ptype =ICE_FLTR_PTYPE_NONF_NONE ; +for (ptype =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; ptype <ICE_FLTR_PTYPE_MAX ; ptype++) {ice_fdir_prof_rm (pf, ptype, false);Signature · 1 line
2.17.1