DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahed Shaikh <shshaikh@marvell.com>
To: <dev@dpdk.org>
Cc: <rmody@marvell.com>, <ferruh.yigit@intel.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/1] net/bnx2x: fix segfaults due to stale interrupt status
Date: Thu, 21 Feb 2019 11:24:44 -0800	[thread overview]
Message-ID: <20190221192444.30575-1-shshaikh@marvell.com> (raw)

Previous ungraceful exit may leave behind un-acked stale
interrupts for slowpath and fastpath.

Interrupt status polling function is started before FLR is
initiated, so we don't have a real way to protect this polling
function invoking an interrupt handler caused due to stale
interrupt status from previous ungraceful exit.

So, check uninitialized status block variables in interrupt
handling path which may lead to sefault.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org

Signed-off-by: Shahed Shaikh <shshaikh@marvell.com>
---
 drivers/net/bnx2x/bnx2x.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 4c775c1..26b3828 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -4201,6 +4201,9 @@ static uint16_t bnx2x_update_dsb_idx(struct bnx2x_softc *sc)
 	struct host_sp_status_block *def_sb = sc->def_sb;
 	uint16_t rc = 0;
 
+	if (!def_sb)
+		return 0;
+
 	mb();			/* status block is written to by the chip */
 
 	if (sc->def_att_idx != def_sb->atten_status_block.attn_bits_index) {
@@ -4525,6 +4528,10 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp)
 	struct bnx2x_softc *sc = fp->sc;
 	uint8_t more_rx = FALSE;
 
+	/* Make sure FP is initialized */
+	if (!fp->sb_running_index)
+		return;
+
 	PMD_DEBUG_PERIODIC_LOG(DEBUG, sc,
 			       "---> FP TASK QUEUE (%d) <--", fp->index);
 
-- 
2.7.4

             reply	other threads:[~2019-02-21 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 19:24 Shahed Shaikh [this message]
2019-02-25 14:47 ` Ferruh Yigit

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=20190221192444.30575-1-shshaikh@marvell.com \
    --to=shshaikh@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=rmody@marvell.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).