DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 18/18] net/bnxt: check VF rep pointer before access
Date: Tue,  4 Jan 2022 14:08:24 +0530	[thread overview]
Message-ID: <20220104083824.23001-19-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20220104083824.23001-1-kalesh-anakkur.purayil@broadcom.com>

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

The PF or trusted VF Rx handler could invoke the VF representor's
Rx function without knowledge of the application cleaning up the
representor ports. Check if the vfr_bp pointer is valid before
accessing it.

Fixes: 6dc83230b43b ("net/bnxt: support port representor data path")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index f24f5ef..5e140f0 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -35,16 +35,20 @@ static const struct eth_dev_ops bnxt_rep_dev_ops = {
 uint16_t
 bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 {
-	struct rte_mbuf **prod_rx_buf;
+	struct bnxt_representor *vfr_bp = NULL;
 	struct bnxt_rx_ring_info *rep_rxr;
-	struct bnxt_rx_queue *rep_rxq;
 	struct rte_eth_dev *vfr_eth_dev;
-	struct bnxt_representor *vfr_bp;
+	struct rte_mbuf **prod_rx_buf;
+	struct bnxt_rx_queue *rep_rxq;
 	uint16_t mask;
 	uint8_t que;
 
 	vfr_eth_dev = &rte_eth_devices[port_id];
-	vfr_bp = vfr_eth_dev->data->dev_private;
+	vfr_bp = vfr_eth_dev ? vfr_eth_dev->data->dev_private : NULL;
+
+	if (unlikely(vfr_bp == NULL))
+		return 1;
+
 	/* If rxq_id happens to be > nr_rings, use ring 0 */
 	que = queue_id < vfr_bp->rx_nr_rings ? queue_id : 0;
 	rep_rxq = vfr_bp->rx_queues[que];
-- 
2.10.1


  parent reply	other threads:[~2022-01-04  8:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  8:38 [dpdk-dev] [PATCH 00/18] bnxt PMD fixes Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 01/18] net/bnxt: fix bnxt_dev_set_mc_addr_list_op Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 02/18] net/bnxt: fix to restore mcast macs during reset recovery Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 03/18] net/bnxt: fix queue stop operation Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 04/18] net/bnxt: restore RSS configuration after reset recovery Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 05/18] net/bnxt: fix restoring VLAN filtering after recovery Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 06/18] net/bnxt: fix to cap max number of unicast MACs Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 07/18] net/bnxt: set fast-path pointers only if recovery succeeds Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 08/18] net/bnxt: improve recovery related log messages Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 09/18] net/bnxt: add null check for mark table Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 10/18] net/bnxt: fix flow create when RSS is disabled Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 11/18] net/bnxt: get max supported multicast filters count Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 12/18] net/bnxt: refactor bnxt_stop_rxtx() for reuse Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 13/18] net/bnxt: fix handling of VF configuration changes Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 14/18] net/bnxt: fix ring teardown Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 15/18] net/bnxt: fix PAM4 mask setting Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 16/18] net/bnxt: fix pointer access Kalesh A P
2022-01-04  8:38 ` [dpdk-dev] [PATCH 17/18] net/bnxt: fix incorrect memset in bnxt_dev_xstats_get_op Kalesh A P
2022-01-04  8:38 ` Kalesh A P [this message]
2022-01-12  2:09 ` [dpdk-dev] [PATCH 00/18] bnxt PMD fixes 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=20220104083824.23001-19-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=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).