From: Dekel Peled Date: Tue, 12 Nov 2019 14:19:20 +0000 (+0200) Subject: net/mlx5: fix verbs flow counter query X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=50d23b9ace7329ba3d4d8bcf39b1ffc85c14c135;p=dpdk.git net/mlx5: fix verbs flow counter query Function flow_verbs_counter_query() was recently modified. The new 'if' condition uses a pointer to flow counter-set. This pointer is valid only if flow contains a count action. This patch adds check to verify the pointer is valid. Fixes: d85c7b5ea59f ("net/mlx5: split hairpin flows") Signed-off-by: Dekel Peled Acked-by: Viacheslav Ovsiienko --- diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index ea85fa1962..c787c9838d 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -191,7 +191,7 @@ flow_verbs_counter_query(struct rte_eth_dev *dev __rte_unused, { #if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) - if (flow->counter->cs) { + if (flow->counter && flow->counter->cs) { struct rte_flow_query_count *qc = data; uint64_t counters[2] = {0, 0}; #if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42)