aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Ghannam <simo.ghannam@gmail.com>2018-01-02 19:44:34 +0000
committerBen Hutchings <ben@decadent.org.uk>2018-02-13 18:32:22 +0000
commit60daca9efbb3e4109ebc1f7069543e5573fc124e (patch)
treeca4699912145836e12803bc6b0e433bebc8cb276
parentd84eeff84e9869d29f442ff652ce1352cfa63e84 (diff)
downloadtip-60daca9efbb3e4109ebc1f7069543e5573fc124e.tar.gz
RDS: Heap OOB write in rds_message_alloc_sgs()
Notice: this object is not reachable from any branch.
commit c095508770aebf1b9218e77026e48345d719b17c upstream. 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> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Notice: this object is not reachable from any branch.
-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 4e37c1cbe8b2f..6bb8a4ca3b7a8 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -516,6 +516,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],