net/bnxt: avoid null pointer dereference
Commit "bd0a14c99f65" enables the creation of a dedicated completion
ring for asynchronous event handling instead of handling these
events on a receive completion ring on non Stingray Platforms.
This causes a segfault due to NULL pointer dereference in
bnxt_alloc_async_cp_ring() on stingray. Fix this by checking the
pointer validity before accessing it.
Fixes: bd0a14c99f
("net/bnxt: use dedicated CPR for async events")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
This commit is contained in:
parent
40d2640fb6
commit
70b8062e85
@ -694,13 +694,15 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
|
|||||||
int bnxt_alloc_async_cp_ring(struct bnxt *bp)
|
int bnxt_alloc_async_cp_ring(struct bnxt *bp)
|
||||||
{
|
{
|
||||||
struct bnxt_cp_ring_info *cpr = bp->async_cp_ring;
|
struct bnxt_cp_ring_info *cpr = bp->async_cp_ring;
|
||||||
struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
|
struct bnxt_ring *cp_ring;
|
||||||
uint8_t ring_type;
|
uint8_t ring_type;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (BNXT_NUM_ASYNC_CPR(bp) == 0)
|
if (BNXT_NUM_ASYNC_CPR(bp) == 0 || cpr == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
cp_ring = cpr->cp_ring_struct;
|
||||||
|
|
||||||
if (BNXT_HAS_NQ(bp))
|
if (BNXT_HAS_NQ(bp))
|
||||||
ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ;
|
ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user