summaryrefslogtreecommitdiff
path: root/net/rds
diff options
context:
space:
mode:
authorMohamed Ghannam <simo.ghannam@gmail.com>2018-01-02 19:44:34 +0000
committerDavid S. Miller <davem@davemloft.net>2018-01-03 11:23:05 -0500
commitc095508770aebf1b9218e77026e48345d719b17c (patch)
tree1f112b635b9bde56a91b6b3de0045f3cbc8ff5ef /net/rds
parentc0bace798436bca0fdc221ff61143f1376a9c3de (diff)
RDS: Heap OOB write in rds_message_alloc_sgs()
When args->nr_local is 0, nr_pages gets also 0 due some size calculation via rds_rm_size(), which is later used to allocate pages for DMA, this bug produces a heap Out-Of-Bound write access to a specific memory region. Signed-off-by: Mohamed Ghannam <simo.ghannam@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/rdma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index bc2f1e0977d6..94729d9da437 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -525,6 +525,9 @@ int rds_rdma_extra_size(struct rds_rdma_args *args)
local_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;
+ if (args->nr_local == 0)
+ return -EINVAL;
+
/* figure out the number of pages in the vector */
for (i = 0; i < args->nr_local; i++) {
if (copy_from_user(&vec, &local_vec[i],