net/mlx5: fix crash on hash Rx queue handling for drop
authorXiaoyu Min <jackmin@mellanox.com>
Thu, 17 Oct 2019 10:49:46 +0000 (13:49 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 23 Oct 2019 14:43:10 +0000 (16:43 +0200)
commit8e2f25cf3c14a9d4c4ee7cf5c6971e9fd5ad64c4
tree81e988141118ac7089602b7ff8962b0e57f6aa35
parent5ad3db8d4bdd7dfca619f7acd969f09cf6adb1df
net/mlx5: fix crash on hash Rx queue handling for drop

When to create hrxq for the drop, it could fail on creating qp and goto
the error handle which will release created ind_table by calling drop
release function, which takes rte_ethdev as the only parameter and uses
the priv->drop_queue.hrxq as input to release.

Unfortunately, at this point, the hrxq is not allocated and
priv->drop_queue.hrxq is still NULL, which leads to a segfault.

This patch fixes the above by allocating the hrxq at first place and
when the error happens, hrxq is released as the last one.

This patch also release other allocated resources by the correct order,
which is missing previously.

Fixes: 78be885295b8 ("net/mlx5: handle drop queues as regular queues")
Cc: stable@dpdk.org
Reported-by: Zengmo Gao <gaozengmo@jd.com>
Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5_rxq.c