From 29e5519dab554407f9d375abb40fdb57f8d445db Mon Sep 17 00:00:00 2001 From: Weiguo Li Date: Tue, 25 Jan 2022 22:23:48 +0800 Subject: [PATCH] net/dpaa2: fix null pointer dereference Check for memory allocation failure is added to avoid null pointer dereference. Fixes: 4690a6114ff6 ("net/dpaa2: enable error queues optionally") Cc: stable@dpdk.org Signed-off-by: Weiguo Li Reviewed-by: Ferruh Yigit --- drivers/net/dpaa2/dpaa2_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 09105f049e..379daec5f4 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -399,6 +399,8 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) if (dpaa2_enable_err_queue) { priv->rx_err_vq = rte_zmalloc("dpni_rx_err", sizeof(struct dpaa2_queue), 0); + if (!priv->rx_err_vq) + goto fail; dpaa2_q = (struct dpaa2_queue *)priv->rx_err_vq; dpaa2_q->q_storage = rte_malloc("err_dq_storage",