Commit 18d6e9f2 authored by Mohamed Ghannam's avatar Mohamed Ghannam Committed by Kleber Sacilotto de Souza

RDS: Heap OOB write in rds_message_alloc_sgs()

BugLink: http://bugs.launchpad.net/bugs/1745266

[ Upstream commit c0955087 ]

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: default avatarMohamed Ghannam <simo.ghannam@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 538b563d
...@@ -517,6 +517,9 @@ int rds_rdma_extra_size(struct rds_rdma_args *args) ...@@ -517,6 +517,9 @@ int rds_rdma_extra_size(struct rds_rdma_args *args)
local_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr; 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 */ /* figure out the number of pages in the vector */
for (i = 0; i < args->nr_local; i++) { for (i = 0; i < args->nr_local; i++) {
if (copy_from_user(&vec, &local_vec[i], if (copy_from_user(&vec, &local_vec[i],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment