[PATCH] mem: fix infinite loop
Dengdui Huang
huangdengdui at huawei.com
Wed Apr 2 14:42:58 CEST 2025
When the process address space is insufficient,
mmap will fail, which will cause an infinite loop.
This pathc fix it.
Fixes: c4b89ecb64ea ("eal: introduce memory management wrappers")
Cc: stable at dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
---
lib/eal/common/eal_common_memory.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c
index a185e0b580..0c997201bd 100644
--- a/lib/eal/common/eal_common_memory.c
+++ b/lib/eal/common/eal_common_memory.c
@@ -101,8 +101,12 @@ eal_get_virtual_area(void *requested_addr, size_t *size,
mapped_addr = eal_mem_reserve(
requested_addr, (size_t)map_sz, reserve_flags);
- if ((mapped_addr == NULL) && allow_shrink)
- *size -= page_sz;
+ if (mapped_addr == NULL) {
+ if (allow_shrink)
+ *size -= page_sz;
+ else
+ break;
+ }
if ((mapped_addr != NULL) && addr_is_hint &&
(mapped_addr != requested_addr)) {
--
2.33.0
More information about the dev
mailing list