From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
stable@dpdk.org, Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>,
Rahul Gupta <rahul.gupta@broadcom.com>,
Lance Richardson <lance.richardson@broadcom.com>
Subject: [dpdk-stable] [PATCH v2 13/13] net/bnxt: avoid null pointer dereference
Date: Fri, 30 Aug 2019 09:35:37 -0700 [thread overview]
Message-ID: <20190830163537.32704-14-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20190830163537.32704-1-ajit.khaparde@broadcom.com>
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
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 defreference in
bnxt_alloc_async_cp_ring() on stingray. Fix this by checking the
pointer validity before accessing it.
Fixes: bd0a14c99f65 ("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 Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
drivers/net/bnxt/bnxt_ring.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 2f57e038a..ec17783cf 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -694,13 +694,15 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
int bnxt_alloc_async_cp_ring(struct bnxt *bp)
{
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;
int rc;
- if (BNXT_NUM_ASYNC_CPR(bp) == 0)
+ if (BNXT_NUM_ASYNC_CPR(bp) == 0 || cpr == NULL)
return 0;
+ cp_ring = cpr->cp_ring_struct;
+
if (BNXT_HAS_NQ(bp))
ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ;
else
--
2.20.1 (Apple Git-117)
parent reply other threads:[~2019-08-30 16:36 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20190830163537.32704-1-ajit.khaparde@broadcom.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190830163537.32704-14-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=lance.richardson@broadcom.com \
--cc=rahul.gupta@broadcom.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).