The worker_id may come from user input.
So it is necessary to verify it.

Fixes: a95d70547c57 ("eal: factorize lcore main loop")
Cc: sta...@dpdk.org

Signed-off-by: Dengdui Huang <huangdeng...@huawei.com>
---
 lib/eal/common/eal_common_launch.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/eal/common/eal_common_launch.c 
b/lib/eal/common/eal_common_launch.c
index 5320c3bd3c..76313d5cdf 100644
--- a/lib/eal/common/eal_common_launch.c
+++ b/lib/eal/common/eal_common_launch.c
@@ -35,6 +35,9 @@ rte_eal_remote_launch(lcore_function_t *f, void *arg, 
unsigned int worker_id)
 {
        int rc = -EBUSY;
 
+       if (!rte_lcore_has_role(worker_id, ROLE_RTE))
+               return -EINVAL;
+
        /* Check if the worker is in 'WAIT' state. Use acquire order
         * since 'state' variable is used as the guard variable.
         */
-- 
2.33.0

Reply via email to