From: Somnath Kotur <somnath.kotur@broadcom.com>
To: stable@dpdk.org
Cc: luca.boccassi@gmail.com,
Somnath Kotur <somnath.kotur@broadcom.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [dpdk-stable] [19.11 1/2] net/bnxt: fix checking VNIC in shutdown path
Date: Thu, 29 Oct 2020 14:14:18 +0530 [thread overview]
Message-ID: <20201029084419.9783-1-somnath.kotur@broadcom.com> (raw)
[ backported from upstream commit 4b029f02de3a0ce9cdd9a3475b84ca2e42d74281 ]
Add a couple of NULL pointer checks in bnxt_free_all_filters()
and bnxt_free_vnics() respectively to guard against certain error
injection/recovery scenarios where it was found that the application
was crashing with the bp->vnic_info pointer being NULL.
Fixes: 51fafb89a9a0 ("net/bnxt: get rid of ff pools and use VNIC info array")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_filter.c | 15 +++++++++------
drivers/net/bnxt/bnxt_vnic.c | 3 +++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 622a9bb41..f4b18d5b8 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -81,6 +81,15 @@ void bnxt_free_all_filters(struct bnxt *bp)
struct bnxt_filter_info *filter, *temp_filter;
unsigned int i;
+ for (i = 0; i < bp->pf.max_vfs; i++) {
+ STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
+ bnxt_hwrm_clear_l2_filter(bp, filter);
+ }
+ }
+
+ if (bp->vnic_info == NULL)
+ return;
+
for (i = 0; i < bp->nr_vnics; i++) {
vnic = &bp->vnic_info[i];
filter = STAILQ_FIRST(&vnic->filter);
@@ -94,12 +103,6 @@ void bnxt_free_all_filters(struct bnxt *bp)
}
STAILQ_INIT(&vnic->filter);
}
-
- for (i = 0; i < bp->pf.max_vfs; i++) {
- STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
- bnxt_hwrm_clear_l2_filter(bp, filter);
- }
- }
}
void bnxt_free_filter_mem(struct bnxt *bp)
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index bc054a8e0..ef0772114 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -78,6 +78,9 @@ void bnxt_free_all_vnics(struct bnxt *bp)
struct bnxt_vnic_info *vnic;
unsigned int i;
+ if (bp->vnic_info == NULL)
+ return;
+
for (i = 0; i < bp->max_vnics; i++) {
vnic = &bp->vnic_info[i];
STAILQ_INSERT_TAIL(&bp->free_vnic_list, vnic, next);
--
2.28.0.497.g54e85e7
next reply other threads:[~2020-10-29 8:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 8:44 Somnath Kotur [this message]
2020-10-29 8:44 ` [dpdk-stable] [19.11 2/2] net/bnxt: add separate mutex for FW health check Somnath Kotur
2020-10-29 10:36 ` [dpdk-stable] [19.11 1/2] net/bnxt: fix checking VNIC in shutdown path Luca Boccassi
2020-10-29 10:44 ` Somnath Kotur
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=20201029084419.9783-1-somnath.kotur@broadcom.com \
--to=somnath.kotur@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=luca.boccassi@gmail.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).