summaryrefslogtreecommitdiff
path: root/drivers/net/bnxt/bnxt_rxr.c
diff options
context:
space:
mode:
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>2019-10-09 14:16:17 +0530
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-23 16:43:09 +0200
commit5e592e8d4091da4ad1faadd9c3719bd4c245cca4 (patch)
tree1d671d3d36adba3fa3d58edd8727ba8ed983124c /drivers/net/bnxt/bnxt_rxr.c
parent93b59ccf12ac89850fb77977bbf9aa0199b6acf5 (diff)
downloaddpdk-next-eventdev-5e592e8d4091da4ad1faadd9c3719bd4c245cca4.zip
dpdk-next-eventdev-5e592e8d4091da4ad1faadd9c3719bd4c245cca4.tar.gz
dpdk-next-eventdev-5e592e8d4091da4ad1faadd9c3719bd4c245cca4.tar.xz
net/bnxt: fix dereference before null check
This patch fixes potential null pointer access in bnxt_alloc_ag_data(). Fix to return an error if null check is true. Fixes: daef48efe5e5 ("net/bnxt: support set MTU") Cc: stable@dpdk.org Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Diffstat (limited to 'drivers/net/bnxt/bnxt_rxr.c')
-rw-r--r--drivers/net/bnxt/bnxt_rxr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index f0f9b02..03dae57 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -63,18 +63,22 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
struct bnxt_sw_rx_bd *rx_buf = &rxr->ag_buf_ring[prod];
struct rte_mbuf *mbuf;
+ if (rxbd == NULL) {
+ PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
+ return -EINVAL;
+ }
+
+ if (rx_buf == NULL) {
+ PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
+ return -EINVAL;
+ }
+
mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
if (!mbuf) {
rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
return -ENOMEM;
}
- if (rxbd == NULL)
- PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
- if (rx_buf == NULL)
- PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
-
-
rx_buf->mbuf = mbuf;
mbuf->data_off = RTE_PKTMBUF_HEADROOM;