[PATCH v7 13/18] eal: check tailq length

Stephen Hemminger
2025-12-24T22:14:31Z

The tailq name should not be allowed to exceed limits.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/eal/common/eal_common_tailqs.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/lib/eal/common/eal_common_tailqs.c b/lib/eal/common/eal_common_tailqs.c
index 47080d75ac..7502836c6d 100644
--- a/lib/eal/common/eal_common_tailqs.c
+++ b/lib/eal/common/eal_common_tailqs.c
@@ -67,6 +67,11 @@ rte_eal_tailq_create(const char *name)
{
struct rte_tailq_head *head = NULL;

+ if (strlen(name) >= sizeof(head->name)) {
+ EAL_LOG(ERR, "tailq name '%s' is too long", name);
+ return NULL;
+ }
+
if (!rte_eal_tailq_lookup(name) &&
(rte_tailqs_count + 1 < RTE_MAX_TAILQ)) {
struct rte_mem_config *mcfg;
--
2.51.0