patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 19.11 3/9] net/bnxt: fix double free in port start failure
Date: Thu, 20 May 2021 15:46:48 +0530	[thread overview]
Message-ID: <20210520101654.3214-4-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210520101654.3214-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

[ upstream commit 39a03b401e4a72a118bae60c5834be2b6913098e ]

During port start when bnxt_start_nic() fails, it tries to free
"intr_handle->intr_vec" but the variable is not set to NULL after that.
If port start fails, driver invokes bnxt_dev_stop() which will lead
to a double free of "intr_handle->intr_vec".

Fix it by removing the call to free "intr_handle->intr_vec" in the
bnxt_start_nic() failure path as it is anyway doing in bnxt_dev_stop().

Fixes: 9d276b439aaf ("net/bnxt: fix error handling in device start")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 26cc3dc..bcdf1fc 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -442,7 +442,7 @@ static int bnxt_init_chip(struct bnxt *bp)
 			PMD_DRV_LOG(ERR, "Failed to allocate %d rx_queues"
 				" intr_vec", bp->eth_dev->data->nb_rx_queues);
 			rc = -ENOMEM;
-			goto err_disable;
+			goto err_out;
 		}
 		PMD_DRV_LOG(DEBUG, "intr_handle->intr_vec = %p "
 			"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
@@ -462,13 +462,13 @@ static int bnxt_init_chip(struct bnxt *bp)
 #ifndef RTE_EXEC_ENV_FREEBSD
 	/* In FreeBSD OS, nic_uio driver does not support interrupts */
 	if (rc)
-		goto err_free;
+		goto err_out;
 #endif
 
 	rc = bnxt_get_hwrm_link_config(bp, &new);
 	if (rc) {
 		PMD_DRV_LOG(ERR, "HWRM Get link config failure rc: %x\n", rc);
-		goto err_free;
+		goto err_out;
 	}
 
 	if (!bp->link_info.link_up) {
@@ -476,17 +476,13 @@ static int bnxt_init_chip(struct bnxt *bp)
 		if (rc) {
 			PMD_DRV_LOG(ERR,
 				"HWRM link config failure rc: %x\n", rc);
-			goto err_free;
+			goto err_out;
 		}
 	}
 	bnxt_print_link_info(bp->eth_dev);
 
 	return 0;
 
-err_free:
-	rte_free(intr_handle->intr_vec);
-err_disable:
-	rte_intr_efd_disable(intr_handle);
 err_out:
 	/* Some of the error status returned by FW may not be from errno.h */
 	if (rc > 0)
-- 
2.10.1


  parent reply	other threads:[~2021-05-20  9:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 10:16 [dpdk-stable] [PATCH 19.11 0/9] backports for 19.11.9 Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 1/9] net/bnxt: fix build failures after merging patches Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 2/9] net/bnxt: drop unused attribute Kalesh A P
2021-05-20 10:16 ` Kalesh A P [this message]
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 4/9] net/bnxt: fix firmware fatal error handling Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 5/9] net/bnxt: fix memory allocation for command response Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 6/9] net/bnxt: fix timesync when PTP is not supported Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 7/9] net/bnxt: fix VF info allocation Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 8/9] net/bnxt: fix PTP support for Thor Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 9/9] net/bnxt: fix xstats get Kalesh A P

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=20210520101654.3214-4-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@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).