diff options
author | Michael J. Ruhl <michael.j.ruhl@intel.com> | 2017-03-20 17:26:07 -0700 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-04-05 14:45:09 -0400 |
commit | f7b42633720deb5ca8f4bcb175c7dc2933057e7f (patch) | |
tree | 0aaef7407cd748137f51988caf243a9b58c62a08 /drivers/infiniband/hw/hfi1/sdma.c | |
parent | 44dcfa4b182dffed0e1e6535220fcdd12620b9ec (diff) | |
download | linux-stable-f7b42633720deb5ca8f4bcb175c7dc2933057e7f.tar.gz linux-stable-f7b42633720deb5ca8f4bcb175c7dc2933057e7f.tar.bz2 linux-stable-f7b42633720deb5ca8f4bcb175c7dc2933057e7f.zip |
IB/hfi1: Ensure VL index is within bounds
Improve the safety of the code and ensure the array cannot be indexed
out of bounds when picking the CPU for a given SDMA engine.
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/sdma.c')
-rw-r--r-- | drivers/infiniband/hw/hfi1/sdma.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c index d89852b1f984..bfd0d5187e9b 100644 --- a/drivers/infiniband/hw/hfi1/sdma.c +++ b/drivers/infiniband/hw/hfi1/sdma.c @@ -962,6 +962,11 @@ ssize_t sdma_set_cpu_to_sde_map(struct sdma_engine *sde, const char *buf, continue; } + if (vl >= ARRAY_SIZE(rht_node->map)) { + ret = -EINVAL; + goto out; + } + rht_node = rhashtable_lookup_fast(dd->sdma_rht, &cpu, sdma_rht_params); if (!rht_node) { |