patch 'net/dpaa2: fix integer overflow in CCSR region mapping' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:04:14 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/287def80718a1cd40acbabab4ec7350ee842cb19
Thanks.
Kevin
---
>From 287def80718a1cd40acbabab4ec7350ee842cb19 Mon Sep 17 00:00:00 2001
From: Hemant Agrawal <hemant.agrawal at nxp.com>
Date: Tue, 20 Oct 2026 20:18:32 +0530
Subject: [PATCH] net/dpaa2: fix integer overflow in CCSR region mapping
[ upstream commit 76594ee1d104260ca663cbec8ed27cda92715b59 ]
In lsx_ccsr_map_region(), PAGE_SIZE is defined as
sysconf(_SC_PAGESIZE), which returns a signed long and may be
negative on error. The value was used directly in size_t
comparisons and mmap() length calculations, leading to an
integer overflow (Coverity CID 49765682).
The old code also computed the mapping length without taking
the address offset within the page into account. As a result,
regions crossing a page boundary might not be fully mapped.
The mapping size must cover the entire range from the
page-aligned start address through offset + len.
Fix by validating the page size returned by sysconf(),
deriving the page mask from the validated value, and using
RTE_ALIGN_CEIL(offset + len, page_size) to calculate the
mapping length.
Coverity issue: 49765682
Fixes: f023d059769f ("net/dpaa2: support recycle loopback port")
Signed-off-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
drivers/net/dpaa2/dpaa2_recycle.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index d1e21dd4d1..9410056c98 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -179,4 +179,7 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
uint64_t start;
uint64_t offset;
+ uint64_t page_mask;
+ long page_size;
+ size_t map_len;
fd = open("/dev/mem", O_RDWR);
@@ -186,18 +189,22 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
}
- start = addr & PAGE_MASK;
+ page_size = sysconf(_SC_PAGESIZE);
+ if (page_size <= 0) {
+ close(fd);
+ return NULL;
+ }
+ page_mask = ~((uint64_t)page_size - 1);
+ start = addr & page_mask;
offset = addr - start;
- len = len & PAGE_MASK;
- if (len < (size_t)PAGE_SIZE)
- len = PAGE_SIZE;
+ map_len = RTE_ALIGN_CEIL(offset + len, (size_t)page_size);
- tmp = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start);
+ tmp = mmap(NULL, map_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start);
close(fd);
- if (tmp != MAP_FAILED)
- return (uint8_t *)tmp + offset;
- else
+ if (tmp == MAP_FAILED)
return NULL;
+
+ return (uint8_t *)tmp + offset;
}
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:48.465970462 +0000
+++ 0328-net-dpaa2-fix-integer-overflow-in-CCSR-region-mappin.patch 2026-12-03 12:52:39.249678180 +0000
@@ -1 +1 @@
-From 76594ee1d104260ca663cbec8ed27cda92715b59 Mon Sep 17 00:00:00 2001
+From 287def80718a1cd40acbabab4ec7350ee842cb19 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 76594ee1d104260ca663cbec8ed27cda92715b59 ]
+
@@ -25 +26,0 @@
-Cc: stable at dpdk.org
@@ -33 +34 @@
-index f78d12362e..9b6ae3f515 100644
+index d1e21dd4d1..9410056c98 100644
@@ -36 +37 @@
-@@ -177,4 +177,7 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
+@@ -179,4 +179,7 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
@@ -44 +45 @@
-@@ -184,18 +187,22 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
+@@ -186,18 +189,22 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
More information about the stable
mailing list