Skip to content

Commit 80a7148

Browse files
0x36jfvogel
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. Reported-by: [email protected] Signed-off-by: Mohamed Ghannam <[email protected]> Signed-off-by: David S. Miller <[email protected]> Orabug: 28972461 (cherry picked from commit c095508) cherry-pick-repo=git/davem/net-next.git Signed-off-by: Ka-Cheong Poon <[email protected]> Reviewed-by: Håkon Bugge <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Orabug: 33590097 UEK6 => UEK7 (cherry picked from commit 890b069) cherry-pick-repo=UEK/production/linux-uek.git Signed-off-by: Gerd Rausch <[email protected]> Reviewed-by: William Kucharski <[email protected]>
1 parent 13ce984 commit 80a7148

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
@@ -514,6 +514,9 @@ static int rds_rdma_pages(struct rds_rdma_args *args)
514514

515515
local_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;
516516

517+
if (args->nr_local == 0)
518+
return -EINVAL;
519+
517520
/* figure out the number of pages in the vector */
518521
for (i = 0; i < args->nr_local; i++) {
519522
if (copy_from_user(&vec, &local_vec[i],

0 commit comments

Comments
 (0)