diff options
author | Eyal Itkin <eyal.itkin@gmail.com> | 2017-02-07 16:45:19 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-02-08 12:28:30 -0500 |
commit | 647bf3d8a8e5777319da92af672289b2a6c4dc66 (patch) | |
tree | 8d9a8e7885ba0e86ef6d52b1feffb3b698fc42ba /drivers/infiniband/sw | |
parent | 628f07d33c1f2e7bf31e0a4a988bb07914bd5e73 (diff) | |
download | blackbird-op-linux-647bf3d8a8e5777319da92af672289b2a6c4dc66.tar.gz blackbird-op-linux-647bf3d8a8e5777319da92af672289b2a6c4dc66.zip |
IB/rxe: Fix mem_check_range integer overflow
Update the range check to avoid integer-overflow in edge case.
Resolves CVE 2016-8636.
Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/sw')
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_mr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c index d0faca294006..86a6585b847d 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -59,9 +59,11 @@ int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length) case RXE_MEM_TYPE_MR: case RXE_MEM_TYPE_FMR: - return ((iova < mem->iova) || - ((iova + length) > (mem->iova + mem->length))) ? - -EFAULT : 0; + if (iova < mem->iova || + length > mem->length || + iova > mem->iova + mem->length - length) + return -EFAULT; + return 0; default: return -EFAULT; |