netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDS: Heap OOB write in rds_message_alloc_sgs()
@ 2018-01-02 19:44 simo.ghannam
  2018-01-03 16:24 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: simo.ghannam @ 2018-01-02 19:44 UTC (permalink / raw)
  To: netdev; +Cc: Mohamed Ghannam

From: Mohamed Ghannam <simo.ghannam@gmail.com>

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>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDS: Heap OOB write in rds_message_alloc_sgs()
  2018-01-02 19:44 [PATCH] RDS: Heap OOB write in rds_message_alloc_sgs() simo.ghannam
@ 2018-01-03 16:24 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-01-03 16:24 UTC (permalink / raw)
  To: simo.ghannam; +Cc: netdev

From: simo.ghannam@gmail.com
Date: Tue,  2 Jan 2018 19:44:34 +0000

> From: Mohamed Ghannam <simo.ghannam@gmail.com>
> 
> 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>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-03 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 19:44 [PATCH] RDS: Heap OOB write in rds_message_alloc_sgs() simo.ghannam
2018-01-03 16:24 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).