From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v3 21/24] net/bnxt: prevent interrupt handler from accessing freed memory
Date: Thu, 28 Sep 2017 09:13:26 -0500 [thread overview]
Message-ID: <20170928141329.73874-22-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170928141329.73874-1-ajit.khaparde@broadcom.com>
In some cases the interrupt handler is accessing cpr, which has
already been freed causing segfaults. This patch avoids such accesses.
Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_cpr.c | 2 ++
drivers/net/bnxt/bnxt_irq.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 68979bc43..26b2755e1 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -183,8 +183,10 @@ void bnxt_free_def_cp_ring(struct bnxt *bp)
return;
bnxt_free_ring(cpr->cp_ring_struct);
+ cpr->cp_ring_struct = NULL;
rte_free(cpr->cp_ring_struct);
rte_free(cpr);
+ bp->def_cp_ring = NULL;
}
/* For the default completion ring only */
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 47cda7e52..79a119623 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -55,6 +55,9 @@ static void bnxt_int_handler(void *param)
struct cmpl_base *cmp;
while (1) {
+ if (!cpr || !cpr->cp_ring_struct)
+ return;
+
cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
cmp = &cpr->cp_desc_ring[cons];
--
2.13.5 (Apple Git-94)
next prev parent reply other threads:[~2017-09-28 14:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 14:13 [dpdk-dev] [PATCH v3 00/24] bnxt patchset Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 01/24] net/bnxt: fix HWRM_*() macros and locking Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 02/24] net/bnxt: use 64-bits of address for vlan_table Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 03/24] net/bnxt: fix an issue with group id calculation Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 04/24] net/bnxt: fix calculation of number of pools Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 05/24] net/bnxt: handle multi queue mode properly Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 06/24] net/bnxt: fix rx handling and buffer allocation logic Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 07/24] net/bnxt: fix an issue with broadcast traffic Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 08/24] net/bnxt: fix usage of ETH_VMDQ_* flags Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 09/24] net/bnxt: set checksum offload flags correctly Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 10/24] net/bnxt: update status of Rx IP/L4 CKSUM Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 11/24] net/bnxt: add support for xstats get by id Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 12/24] net/bnxt: fix config rss update Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 13/24] net/bnxt: set the hash_key_size Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 14/24] net/bnxt: add support for rx_queue_count Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 15/24] net/bnxt: add support for rx_descriptor_status Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 16/24] net/bnxt: add support for tx_descriptor_status Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 17/24] net/bnxt: add new HWRM structs to support flow filtering Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 18/24] net/bnxt: add support for flow filter ops Ajit Khaparde
2017-09-28 16:05 ` Ferruh Yigit
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 19/24] doc: update release notes Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 20/24] net/bnxt: fix per queue stats display in xstats Ajit Khaparde
2017-09-28 14:13 ` Ajit Khaparde [this message]
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 22/24] net/bnxt: add dev_supported_ptypes_get dev_op Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 23/24] net/bnxt: add support for get/set EEPROM Ajit Khaparde
2017-09-28 14:13 ` [dpdk-dev] [PATCH v3 24/24] net/bnxt: add support for rx_queue_intr_enable/disable APIs Ajit Khaparde
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=20170928141329.73874-22-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/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).