]> git.droids-corp.org - dpdk.git/commitdiff
net/dpaa2: fix null pointer dereference
authorWeiguo Li <liwg06@foxmail.com>
Tue, 25 Jan 2022 14:23:48 +0000 (22:23 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 28 Jan 2022 15:10:52 +0000 (16:10 +0100)
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 <liwg06@foxmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/dpaa2/dpaa2_ethdev.c

index 09105f049e89168c20fc92e4972928f172f5c7f8..379daec5f4e81c604c9b8b030623dafe27764323 100644 (file)
@@ -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",