[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211206150231.2283069-2-Liam.Howlett@oracle.com>
Date: Mon, 6 Dec 2021 15:02:52 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: Liam Howlett <liam.howlett@...cle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Vineet Gupta <vgupta@...nel.org>,
"linux-snps-arc@...ts.infradead.org"
<linux-snps-arc@...ts.infradead.org>
Subject: [RFC PATCH 1/6] ARC: mm/mmap.c: Check length of unmapped area before
allowing MAP_FIXED
arch_get_unmapped_area() could potentially allow a larger than possible
length when using the MAP_FIXED flag. The bound check should come
before the check for MAP_FIXED.
Fixes: 5bba49f5397c (ARC: [mm] Aliasing VIPT dcache support 4/4)
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
arch/arc/mm/mmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c
index 722d26b94307..1d7076406c4e 100644
--- a/arch/arc/mm/mmap.c
+++ b/arch/arc/mm/mmap.c
@@ -35,6 +35,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
int aliasing = cache_is_vipt_aliasing();
struct vm_unmapped_area_info info;
+ if (len > TASK_SIZE)
+ return -ENOMEM;
+
/*
* We only need to do colour alignment if D cache aliases.
*/
@@ -51,9 +54,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
return addr;
}
- if (len > TASK_SIZE)
- return -ENOMEM;
-
if (addr) {
if (do_align)
addr = COLOUR_ALIGN(addr, pgoff);
--
2.30.2
Powered by blists - more mailing lists