Skip to contentSkip to conversation

net/ice: fix NULL dereference on ACL init failure

PATCH Applied Anurag Mandal 2 participants 2 messages Nov 6 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: fix NULL dereference on ACL init failure

If ice_acl_init() fails to allocate the ACL profile array, it leaves hw->acl_prof NULL.
ice_flow_init() then fails and ice_dev_init() calls ice_flow_uninit(), where ice_acl_prof_free() dereferences the NULL array.

Return early from ice_acl_prof_free() when the array was never allocated.

Fixes 40d466fa9f76 ("net/ice: support ACL filter in DCF")
Fixes 96b25c496aad ("net/ice: fix memzone leak after device init failure")
---
 drivers/net/intel/ice/ice_acl_filter.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/intel/ice/ice_acl_filter.c +3 -0
index 6cf8c83738..94c9ea89fd 100644
@@ -1065,6 +1065,9 @@ ice_acl_prof_free(struct ice_hw *hw)
 {
 	enum ice_fltr_ptype ptype;
 
+	if (hw->acl_prof == NULL)
+		return;
+
 	for (ptype = ICE_FLTR_PTYPE_NONF_NONE + 1;
 	     ptype < ICE_FLTR_PTYPE_MAX; ptype++) {
 		ice_free(hw, hw->acl_prof[ptype]);
Signature · 1 line
2.25.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 9 lines · Anurag Mandal

If ice_acl_init() fails to allocate the ACL profile array, it leaves hw->acl_prof NULL.
ice_flow_init() then fails and ice_dev_init() calls ice_flow_uninit(), where ice_acl_prof_free() dereferences the NULL array.

Return early from ice_acl_prof_free() when the array was never allocated.

Quoted 9 lines
Fixes 40d466fa9f76 ("net/ice: support ACL filter in DCF")
Fixes 96b25c496aad ("net/ice: fix memzone leak after device init failure")
---
 drivers/net/intel/ice/ice_acl_filter.c | 3 +++
 1 file changed, 3 insertions(+)

Applied to dpdk-next-net-intel.
Thanks,
/Bruce