Skip to content

Commit c095508

Browse files
0x36davem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c0bace7 commit c095508

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/rds/rdma.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ int rds_rdma_extra_size(struct rds_rdma_args *args)
525525

526526
local_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;
527527

528+
if (args->nr_local == 0)
529+
return -EINVAL;
530+
528531
/* figure out the number of pages in the vector */
529532
for (i = 0; i < args->nr_local; i++) {
530533
if (copy_from_user(&vec, &local_vec[i],

0 commit comments

Comments
 (0)