Skip to content

Commit

Permalink
RDS: Heap OOB write in rds_message_alloc_sgs()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
0x36 authored and davem330 committed Jan 3, 2018
1 parent c0bace7 commit c095508
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/rds/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit c095508

Please sign in to comment.