event: Verify lcore is valid when registering poller

If we do not do a bounds check, this can run off the end
of an array.

Change-Id: I43cc4848fca7d68218e507db20e33823f8b550e4
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2017-03-23 14:12:01 +08:00 committed by Daniel Verkamp
parent 4b887a8cbc
commit 0c0582d3ce

View File

@ -722,6 +722,12 @@ spdk_poller_register(struct spdk_poller **ppoller, spdk_poller_fn fn, void *arg,
abort();
}
if (lcore >= RTE_MAX_LCORE) {
SPDK_ERRLOG("Attempted use lcore %u larger than max lcore %u\n",
lcore, RTE_MAX_LCORE - 1);
abort();
}
*ppoller = poller;
reactor = spdk_reactor_get(lcore);