From dd282b2588efb6a7a607b66fdc40079b8d58eed1 Mon Sep 17 00:00:00 2001 From: Vinayak Menon Date: Thu, 3 Jan 2019 12:56:52 +0530 Subject: [PATCH] mm: usercopy: skip stack page span check Kernel stack pages can span multiple pages and GFP_COMP is not set for stack pages. Fix the false "spans multiple pages" error. Change-Id: I2ba414be466b7c90fb4a3542237da809175e0590 Signed-off-by: Vinayak Menon [swatsrid@codeaurora.org: Fix trivial merge conflicts] Signed-off-by: Swathi Sridhar Signed-off-by: Isaac J. Manjarres --- mm/usercopy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/usercopy.c b/mm/usercopy.c index 660717a1ea5c..1b86537d0094 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -164,6 +164,8 @@ static inline void check_page_span(const void *ptr, unsigned long n, const void *end = ptr + n - 1; struct page *endpage; bool is_reserved, is_cma; + const void * const stack = task_stack_page(current); + const void * const stackend = stack + THREAD_SIZE; /* * Sometimes the kernel data regions are not marked Reserved (see @@ -188,6 +190,10 @@ static inline void check_page_span(const void *ptr, unsigned long n, end <= (const void *)__bss_stop) return; + /* Allow stack region to span multiple pages */ + if (ptr >= stack && end <= stackend) + return; + /* Is the object wholly within one base page? */ if (likely(((unsigned long)ptr & (unsigned long)PAGE_MASK) == ((unsigned long)end & (unsigned long)PAGE_MASK)))