patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 11/11] common/dpaax: fix paddr to vaddr invalid conversion
       [not found] <20210927122650.30881-1-nipun.gupta@nxp.com>
@ 2021-09-27 12:26 ` nipun.gupta
       [not found] ` <20210927132519.19264-1-nipun.gupta@nxp.com>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: nipun.gupta @ 2021-09-27 12:26 UTC (permalink / raw)
  To: dev
  Cc: thomas, ferruh.yigit, hemant.agrawal, sachin.saxena, stable,
	Gagandeep Singh, Nipun Gupta

From: Gagandeep Singh <g.singh@nxp.com>

If some of the VA entries of table are somehow not populated and are
NULL, it can add offset to NULL and return the invalid VA in PA to
VA conversion.

In this patch, adding a check if the VA entry has valid address only
then add offset and return VA.

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

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.h b/drivers/common/dpaax/dpaax_iova_table.h
index 230fba8ba0..d7087ee7ca 100644
--- a/drivers/common/dpaax/dpaax_iova_table.h
+++ b/drivers/common/dpaax/dpaax_iova_table.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #ifndef _DPAAX_IOVA_TABLE_H_
@@ -101,6 +101,12 @@ dpaax_iova_table_get_va(phys_addr_t paddr) {
 
 		/* paddr > entry->start && paddr <= entry->(start+len) */
 		index = (paddr_align - entry[i].start)/DPAAX_MEM_SPLIT;
+		/* paddr is within range, but no vaddr entry ever written
+		 * at index
+		 */
+		if ((void *)entry[i].pages[index] == NULL)
+			return NULL;
+
 		vaddr = (void *)((uintptr_t)entry[i].pages[index] + offset);
 		break;
 	} while (1);
-- 
2.17.1


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

* [dpdk-stable] [PATCH v1 11/11] common/dpaax: fix paddr to vaddr invalid conversion
       [not found] ` <20210927132519.19264-1-nipun.gupta@nxp.com>
@ 2021-09-27 13:25   ` nipun.gupta
  0 siblings, 0 replies; 4+ messages in thread
From: nipun.gupta @ 2021-09-27 13:25 UTC (permalink / raw)
  To: dev
  Cc: thomas, ferruh.yigit, hemant.agrawal, sachin.saxena, stable,
	Gagandeep Singh, Nipun Gupta

From: Gagandeep Singh <g.singh@nxp.com>

If some of the VA entries of table are somehow not populated and are
NULL, it can add offset to NULL and return the invalid VA in PA to
VA conversion.

In this patch, adding a check if the VA entry has valid address only
then add offset and return VA.

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

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.h b/drivers/common/dpaax/dpaax_iova_table.h
index 230fba8ba0..d7087ee7ca 100644
--- a/drivers/common/dpaax/dpaax_iova_table.h
+++ b/drivers/common/dpaax/dpaax_iova_table.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #ifndef _DPAAX_IOVA_TABLE_H_
@@ -101,6 +101,12 @@ dpaax_iova_table_get_va(phys_addr_t paddr) {
 
 		/* paddr > entry->start && paddr <= entry->(start+len) */
 		index = (paddr_align - entry[i].start)/DPAAX_MEM_SPLIT;
+		/* paddr is within range, but no vaddr entry ever written
+		 * at index
+		 */
+		if ((void *)entry[i].pages[index] == NULL)
+			return NULL;
+
 		vaddr = (void *)((uintptr_t)entry[i].pages[index] + offset);
 		break;
 	} while (1);
-- 
2.17.1


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

* [dpdk-stable] [PATCH v2 10/10] common/dpaax: fix paddr to vaddr invalid conversion
       [not found] ` <20211006121022.27119-1-nipun.gupta@nxp.com>
@ 2021-10-06 12:10   ` nipun.gupta
  0 siblings, 0 replies; 4+ messages in thread
From: nipun.gupta @ 2021-10-06 12:10 UTC (permalink / raw)
  To: dev
  Cc: thomas, ferruh.yigit, hemant.agrawal, sachin.saxena, stable,
	Gagandeep Singh, Nipun Gupta

From: Gagandeep Singh <g.singh@nxp.com>

If some of the VA entries of table are somehow not populated and are
NULL, it can add offset to NULL and return the invalid VA in PA to
VA conversion.

In this patch, adding a check if the VA entry has valid address only
then add offset and return VA.

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

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.h b/drivers/common/dpaax/dpaax_iova_table.h
index 230fba8ba0..b1f2300c52 100644
--- a/drivers/common/dpaax/dpaax_iova_table.h
+++ b/drivers/common/dpaax/dpaax_iova_table.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #ifndef _DPAAX_IOVA_TABLE_H_
@@ -101,6 +101,12 @@ dpaax_iova_table_get_va(phys_addr_t paddr) {
 
 		/* paddr > entry->start && paddr <= entry->(start+len) */
 		index = (paddr_align - entry[i].start)/DPAAX_MEM_SPLIT;
+		/* paddr is within range, but no vaddr entry ever written
+		 * at index
+		 */
+		if ((void *)(uintptr_t)entry[i].pages[index] == NULL)
+			return NULL;
+
 		vaddr = (void *)((uintptr_t)entry[i].pages[index] + offset);
 		break;
 	} while (1);
-- 
2.17.1


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

* [dpdk-stable] [PATCH v3 10/10] common/dpaax: fix paddr to vaddr invalid conversion
       [not found] ` <20211006170131.32616-1-nipun.gupta@nxp.com>
@ 2021-10-06 17:01   ` nipun.gupta
  0 siblings, 0 replies; 4+ messages in thread
From: nipun.gupta @ 2021-10-06 17:01 UTC (permalink / raw)
  To: dev
  Cc: thomas, ferruh.yigit, hemant.agrawal, sachin.saxena, stable,
	Gagandeep Singh, Nipun Gupta

From: Gagandeep Singh <g.singh@nxp.com>

If some of the VA entries of table are somehow not populated and are
NULL, it can add offset to NULL and return the invalid VA in PA to
VA conversion.

In this patch, adding a check if the VA entry has valid address only
then add offset and return VA.

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

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.h b/drivers/common/dpaax/dpaax_iova_table.h
index 230fba8ba0..b1f2300c52 100644
--- a/drivers/common/dpaax/dpaax_iova_table.h
+++ b/drivers/common/dpaax/dpaax_iova_table.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #ifndef _DPAAX_IOVA_TABLE_H_
@@ -101,6 +101,12 @@ dpaax_iova_table_get_va(phys_addr_t paddr) {
 
 		/* paddr > entry->start && paddr <= entry->(start+len) */
 		index = (paddr_align - entry[i].start)/DPAAX_MEM_SPLIT;
+		/* paddr is within range, but no vaddr entry ever written
+		 * at index
+		 */
+		if ((void *)(uintptr_t)entry[i].pages[index] == NULL)
+			return NULL;
+
 		vaddr = (void *)((uintptr_t)entry[i].pages[index] + offset);
 		break;
 	} while (1);
-- 
2.17.1


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

end of thread, other threads:[~2021-10-06 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210927122650.30881-1-nipun.gupta@nxp.com>
2021-09-27 12:26 ` [dpdk-stable] [PATCH 11/11] common/dpaax: fix paddr to vaddr invalid conversion nipun.gupta
     [not found] ` <20210927132519.19264-1-nipun.gupta@nxp.com>
2021-09-27 13:25   ` [dpdk-stable] [PATCH v1 " nipun.gupta
     [not found] ` <20211006121022.27119-1-nipun.gupta@nxp.com>
2021-10-06 12:10   ` [dpdk-stable] [PATCH v2 10/10] " nipun.gupta
     [not found] ` <20211006170131.32616-1-nipun.gupta@nxp.com>
2021-10-06 17:01   ` [dpdk-stable] [PATCH v3 " nipun.gupta

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