[1/2] eal: fix wake a incorrect lcore
Checks
Commit Message
If the core is not used in the rte, we can't wake it up to work.
The worker_id may come from user input. So it is necessary to
verify it.
Fixes: a95d70547c57 ("eal: factorize lcore main loop")
Cc: stable@dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
lib/eal/unix/eal_unix_thread.c | 3 +++
lib/eal/windows/eal_thread.c | 3 +++
2 files changed, 6 insertions(+)
@@ -17,6 +17,9 @@ eal_thread_wake_worker(unsigned int worker_id)
char c = 0;
int n;
+ if (m2w == 0 || w2m == 0)
+ return -EINVAL;
+
do {
n = write(m2w, &c, 1);
} while (n == 0 || (n < 0 && errno == EINTR));
@@ -24,6 +24,9 @@ eal_thread_wake_worker(unsigned int worker_id)
char c = 0;
int n;
+ if (m2w == 0 || w2m == 0)
+ return -EINVAL;
+
do {
n = _write(m2w, &c, 1);
} while (n == 0 || (n < 0 && errno == EINTR));