DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hernan Vargas <hernan.vargas@intel.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com, gakhil@marvell.com,
	trix@redhat.com
Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com,
	Hernan Vargas <hernan.vargas@intel.com>,
	stable@dpdk.org
Subject: [PATCH v2 2/6] baseband/fpga_5gnr_fec: fix seg fault unconf queue
Date: Thu, 25 May 2023 11:28:08 -0700	[thread overview]
Message-ID: <20230525182812.152907-3-hernan.vargas@intel.com> (raw)
In-Reply-To: <20230525182812.152907-1-hernan.vargas@intel.com>

Adding exception to prevent segmentation fault in case a queue is
started which was not configured earlier.

Fixes: c58109a8871d ("baseband/fpga_5gnr_fec: add queue configuration")
Cc: stable@dpdk.org

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index 99390c48160c..6b0644ffc5d6 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -567,17 +567,21 @@ static int
 fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id)
 {
 	struct fpga_5gnr_fec_device *d = dev->data->dev_private;
+	struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
+	uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
+			(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);
+	uint8_t enable = 0x01;
+	uint16_t zero = 0x0000;
 #ifdef RTE_LIBRTE_BBDEV_DEBUG
 	if (d == NULL) {
 		rte_bbdev_log(ERR, "Invalid device pointer");
 		return -1;
 	}
 #endif
-	struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
-	uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
-			(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);
-	uint8_t enable = 0x01;
-	uint16_t zero = 0x0000;
+	if (dev->data->queues[queue_id].queue_private == NULL) {
+		rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id);
+		return -1;
+	}
 
 	/* Clear queue head and tail variables */
 	q->tail = q->head_free_desc = 0;
-- 
2.37.1


  parent reply	other threads:[~2023-05-25 18:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 18:28 [PATCH v2 0/6] changes for 23.07 Hernan Vargas
2023-05-25 18:28 ` [PATCH v2 1/6] baseband/fpga_5gnr_fec: fix possible div by zero Hernan Vargas
2023-07-06  9:10   ` Maxime Coquelin
2023-07-06  9:10   ` Maxime Coquelin
2023-05-25 18:28 ` Hernan Vargas [this message]
2023-05-25 18:28 ` [PATCH v2 3/6] baseband/fpga_5gnr_fec: renaming for consistency Hernan Vargas
2023-09-01 16:26   ` Maxime Coquelin
2023-05-25 18:28 ` [PATCH v2 4/6] baseband/fpga_5gnr_fec: add Vista Creek variant Hernan Vargas
2023-09-01 16:36   ` Maxime Coquelin
2023-05-25 18:28 ` [PATCH v2 5/6] baseband/fpga_5gnr_fec: add AGX100 support Hernan Vargas
2023-09-01 17:07   ` Maxime Coquelin
2023-05-25 18:28 ` [PATCH v2 6/6] baseband/fpga_5gnr_fec: cosmetic comment changes Hernan Vargas
2023-09-01 17:10   ` Maxime Coquelin
2023-06-06 14:31 ` [PATCH v2 0/6] changes for 23.07 Vargas, Hernan
2023-06-08 11:53   ` Maxime Coquelin
2023-07-06  9:11 ` Maxime Coquelin
2023-08-29 16:19 ` Vargas, Hernan

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=20230525182812.152907-3-hernan.vargas@intel.com \
    --to=hernan.vargas@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nicolas.chautru@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=trix@redhat.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).