diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-01-10 19:15:48 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-08 08:26:04 (GMT) |
commit | 0081b9e7fcf75e65496f85896d2c3bb42e2a4dd7 (patch) | |
tree | bbd7b669b022dbb51b4de75ae46de9c77434d93c /drivers | |
parent | 2b7aec8839dfe6482b8f6e0b8be0951fc990e964 (diff) | |
download | linux-0081b9e7fcf75e65496f85896d2c3bb42e2a4dd7.tar.xz |
IB/rxe: Add a runtime check in alloc_index()
[ Upstream commit 642c7cbcaf2ffc1e27f67eda3dc47347ac5aff37 ]
Since index values equal to or above 'range' can trigger memory
corruption, complain if index >= range.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Andrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_pool.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c index 6bac071..ee26a1b 100644 --- a/drivers/infiniband/sw/rxe/rxe_pool.c +++ b/drivers/infiniband/sw/rxe/rxe_pool.c @@ -274,6 +274,7 @@ static u32 alloc_index(struct rxe_pool *pool) if (index >= range) index = find_first_zero_bit(pool->table, range); + WARN_ON_ONCE(index >= range); set_bit(index, pool->table); pool->last = index; return index + pool->min_index; |