The removal of FDIR profile should start from ICE_FLTR_PTYPE_NONF_IPV4_UDP.

Fixes: 109e8e06249e ("net/ice: configure HW flow director rule")
Cc: sta...@dpdk.org

Signed-off-by: Wang ShougangX <shougangx.w...@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c 
b/drivers/net/ice/ice_fdir_filter.c
index 736ccd54e..e426c1431 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -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);
-- 
2.17.1

Reply via email to