patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 4/9] bus/dpaa: fix bus scan for DMA devices
       [not found] <20240703094142.3021439-1-g.singh@nxp.com>
@ 2024-07-03  9:41 ` Gagandeep Singh
  2024-07-03  9:41 ` [PATCH 5/9] bus/dpaa: fix resource leak in variable dev Gagandeep Singh
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: Gagandeep Singh @ 2024-07-03  9:41 UTC (permalink / raw)
  To: hemant.agrawal; +Cc: Gagandeep Singh, stable

if there is no sec devices available, code is not scanning QDMA dev
This patch fix this problem by adding a goto statement instead
of return in case no sec device available.

Fixes: 583f3732974f ("dma/dpaa: introduce DPAA DMA driver skeleton")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 8ce93abd84..6d7d9ef918 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -221,7 +221,7 @@ dpaa_create_device_list(void)
 
 	if (dpaa_sec_available()) {
 		DPAA_BUS_LOG(INFO, "DPAA SEC devices are not available");
-		return 0;
+		goto qdma_dpaa;
 	}
 
 	/* Creating SEC Devices */
@@ -260,6 +260,7 @@ dpaa_create_device_list(void)
 
 	rte_dpaa_bus.device_count += i;
 
+qdma_dpaa:
 	/* Creating QDMA Device */
 	for (i = 0; i < RTE_DPAA_QDMA_DEVICES; i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 5/9] bus/dpaa: fix resource leak in variable dev
       [not found] <20240703094142.3021439-1-g.singh@nxp.com>
  2024-07-03  9:41 ` [PATCH 4/9] bus/dpaa: fix bus scan for DMA devices Gagandeep Singh
@ 2024-07-03  9:41 ` Gagandeep Singh
  2024-07-03  9:41 ` [PATCH 6/9] common/dpaax: fix IOVA table cleanup Gagandeep Singh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: Gagandeep Singh @ 2024-07-03  9:41 UTC (permalink / raw)
  To: hemant.agrawal; +Cc: Apeksha Gupta, hkalra, stable

From: Apeksha Gupta <apeksha.gupta@nxp.com>

Resource leak:
variable dev is going out of scope leaks the storage.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: hkalra@marvell.com
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 6d7d9ef918..3155acb6cb 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -188,6 +188,7 @@ dpaa_create_device_list(void)
 		if (dev->intr_handle == NULL) {
 			DPAA_BUS_LOG(ERR, "Failed to allocate intr handle");
 			ret = -ENOMEM;
+			free(dev);
 			goto cleanup;
 		}
 
@@ -239,6 +240,7 @@ dpaa_create_device_list(void)
 		if (dev->intr_handle == NULL) {
 			DPAA_BUS_LOG(ERR, "Failed to allocate intr handle");
 			ret = -ENOMEM;
+			free(dev);
 			goto cleanup;
 		}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 6/9] common/dpaax: fix IOVA table cleanup
       [not found] <20240703094142.3021439-1-g.singh@nxp.com>
  2024-07-03  9:41 ` [PATCH 4/9] bus/dpaa: fix bus scan for DMA devices Gagandeep Singh
  2024-07-03  9:41 ` [PATCH 5/9] bus/dpaa: fix resource leak in variable dev Gagandeep Singh
@ 2024-07-03  9:41 ` Gagandeep Singh
  2024-07-03  9:41 ` [PATCH 7/9] common/dpaax: fix array overrun issue Gagandeep Singh
  2024-07-03  9:41 ` [PATCH 8/9] bus/dpaa: remove redundant file descriptor check Gagandeep Singh
  4 siblings, 0 replies; 5+ messages in thread
From: Gagandeep Singh @ 2024-07-03  9:41 UTC (permalink / raw)
  To: hemant.agrawal; +Cc: Gagandeep Singh, stable

Fixes incorrect structure free

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index 9daac4bc03..d2a78f4c19 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2023 NXP
  */
 
 #include <rte_memory.h>
@@ -255,10 +255,7 @@ dpaax_iova_table_populate(void)
 void
 dpaax_iova_table_depopulate(void)
 {
-	if (dpaax_iova_table_p == NULL)
-		return;
-
-	rte_free(dpaax_iova_table_p->entries);
+	rte_free(dpaax_iova_table_p);
 	dpaax_iova_table_p = NULL;
 
 	DPAAX_DEBUG("IOVA Table cleaned");
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 7/9] common/dpaax: fix array overrun issue
       [not found] <20240703094142.3021439-1-g.singh@nxp.com>
                   ` (2 preceding siblings ...)
  2024-07-03  9:41 ` [PATCH 6/9] common/dpaax: fix IOVA table cleanup Gagandeep Singh
@ 2024-07-03  9:41 ` Gagandeep Singh
  2024-07-03  9:41 ` [PATCH 8/9] bus/dpaa: remove redundant file descriptor check Gagandeep Singh
  4 siblings, 0 replies; 5+ messages in thread
From: Gagandeep Singh @ 2024-07-03  9:41 UTC (permalink / raw)
  To: hemant.agrawal; +Cc: Apeksha Gupta, stable

From: Apeksha Gupta <apeksha.gupta@nxp.com>

Out-of-bounds read, Overrunning dynamic array nodes at offset corresponding
to index variable j.

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index d2a78f4c19..860e702333 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -139,10 +139,12 @@ read_memory_node(unsigned int *count)
 	}
 
 	DPAAX_DEBUG("Device-tree memory node data:");
-	do {
+
+	while (j > 0) {
+		--j;
 		DPAAX_DEBUG("    %08" PRIx64 " %08zu",
 			    nodes[j].addr, nodes[j].len);
-	} while (--j);
+	}
 
 cleanup:
 	close(fd);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 8/9] bus/dpaa: remove redundant file descriptor check
       [not found] <20240703094142.3021439-1-g.singh@nxp.com>
                   ` (3 preceding siblings ...)
  2024-07-03  9:41 ` [PATCH 7/9] common/dpaax: fix array overrun issue Gagandeep Singh
@ 2024-07-03  9:41 ` Gagandeep Singh
  4 siblings, 0 replies; 5+ messages in thread
From: Gagandeep Singh @ 2024-07-03  9:41 UTC (permalink / raw)
  To: hemant.agrawal; +Cc: Rohit Raj, stable

From: Rohit Raj <rohit.raj@nxp.com>

This patch removes the redundant file descriptor check

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/process.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 3504ec97db..3e4622f606 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2011-2016 Freescale Semiconductor Inc.
- * Copyright 2017,2020 NXP
+ * Copyright 2017,2020,2022,2024 NXP
  *
  */
 #include <assert.h>
@@ -27,15 +27,16 @@ static int check_fd(void)
 {
 	int ret;
 
-	if (fd >= 0)
-		return 0;
 	ret = pthread_mutex_lock(&fd_init_lock);
 	assert(!ret);
+
 	/* check again with the lock held */
 	if (fd < 0)
 		fd = open(PROCESS_PATH, O_RDWR);
+
 	ret = pthread_mutex_unlock(&fd_init_lock);
 	assert(!ret);
+
 	return (fd >= 0) ? 0 : -ENODEV;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-03  9:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20240703094142.3021439-1-g.singh@nxp.com>
2024-07-03  9:41 ` [PATCH 4/9] bus/dpaa: fix bus scan for DMA devices Gagandeep Singh
2024-07-03  9:41 ` [PATCH 5/9] bus/dpaa: fix resource leak in variable dev Gagandeep Singh
2024-07-03  9:41 ` [PATCH 6/9] common/dpaax: fix IOVA table cleanup Gagandeep Singh
2024-07-03  9:41 ` [PATCH 7/9] common/dpaax: fix array overrun issue Gagandeep Singh
2024-07-03  9:41 ` [PATCH 8/9] bus/dpaa: remove redundant file descriptor check Gagandeep Singh

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).