[PATCH] RDS: Heap OOB write in rds_message_alloc_sgs()

Subsystems: networking [general], rds - reliable datagram sockets, the rest

STALE3153d

2 messages, 2 authors, 2018-01-03 · open the first message on its own page

[PATCH] RDS: Heap OOB write in rds_message_alloc_sgs()

From: <hidden>
Date: 2018-01-02 19:44:56

From: Mohamed Ghannam <redacted>

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 <redacted>
---
 net/rds/rdma.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index bc2f1e0977d6..40a733566eb7 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -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],
-- 
2.14.1

Re: [PATCH] RDS: Heap OOB write in rds_message_alloc_sgs()

From: David Miller <davem@davemloft.net>
Date: 2018-01-03 16:24:49

From: simo.ghannam@gmail.com
Date: Tue,  2 Jan 2018 19:44:34 +0000
From: Mohamed Ghannam <redacted>

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 <redacted>
Applied and queued up for -stable, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help