From: Yuying Zhang Date: Tue, 28 Jun 2022 04:06:51 +0000 (+0000) Subject: net/ice: fix memory allocation insufficiency X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b84d7eb8862676d2b06e8666ed78479bbbffd17a;p=dpdk.git net/ice: fix memory allocation insufficiency Current code doesn't allocate memory of lookup element to add packet flag. This patch adds one lookup item in the list to fix this memory issue. Fixes: 8b95092b7f69 ("net/ice/base: fix direction of flow that matches any") Cc: stable@dpdk.org Signed-off-by: Yuying Zhang Acked-by: Qi Zhang --- diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 36c9bffb73..e84283fec1 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1863,7 +1863,10 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad, else if (vlan_num == 2) tun_type = ICE_NON_TUN_QINQ; - list = rte_zmalloc(NULL, item_num * sizeof(*list), 0); + /* reserve one more memory slot for direction flag which may + * consume 1 lookup item. + */ + list = rte_zmalloc(NULL, (item_num + 1) * sizeof(*list), 0); if (!list) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,