env/dpdk: add security checks to spdk_env_get_socket_id()
The underlying DPDK function we use reads an array at the provided index without checking for any out of bounds access. The array is RTE_MAX_LCORE elements long, so always manually check against that to keep our APIs safe. This fixes potential crashes with lcore == SPDK_ENV_LCORE_ID_ANY Change-Id: I3081b888275fbecba8ab95feb20d2074341e2fc7 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/425042 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e06896b94c
commit
33ccbba438
@ -84,6 +84,10 @@ spdk_env_get_next_core(uint32_t prev_core)
|
||||
uint32_t
|
||||
spdk_env_get_socket_id(uint32_t core)
|
||||
{
|
||||
if (core >= RTE_MAX_LCORE) {
|
||||
return SPDK_ENV_SOCKET_ID_ANY;
|
||||
}
|
||||
|
||||
return rte_lcore_to_socket_id(core);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user