diff options
author | Mohamed Ghannam <simo.ghannam@gmail.com> | 2018-01-02 19:44:34 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-17 09:38:53 +0100 |
commit | cebb382931c4fb341162eae80b696650260e4a2b (patch) | |
tree | 3bc3aee7609a1ea2a0d5b5f2099f41565b3a9335 /net | |
parent | 61196a67cac4faa27d5e8f765b468bc25822f84d (diff) |
RDS: Heap OOB write in rds_message_alloc_sgs()
[ Upstream commit c095508770aebf1b9218e77026e48345d719b17c ]
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/rds/rdma.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/rds/rdma.c b/net/rds/rdma.c index de8496e60735..4880f9a2d356 100644 --- a/net/rds/rdma.c +++ b/net/rds/rdma.c @@ -524,6 +524,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], |