From: David S. Miller Date: Fri, 12 Feb 2010 20:03:45 +0000 (-0800) Subject: sparc64: Tighten checks in kstack_valid(). X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=232486e1e9f34889424b68ee6270440b554479a2;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git sparc64: Tighten checks in kstack_valid(). The kernel stack pointer is invalid if it is not 16-byte aligned. Based upon a report by Meelis Roos Signed-off-by: David S. Miller --- diff --git a/arch/sparc/kernel/kstack.h b/arch/sparc/kernel/kstack.h index 4248d969272..5247283d1c0 100644 --- a/arch/sparc/kernel/kstack.h +++ b/arch/sparc/kernel/kstack.h @@ -11,6 +11,10 @@ static inline bool kstack_valid(struct thread_info *tp, unsigned long sp) { unsigned long base = (unsigned long) tp; + /* Stack pointer must be 16-byte aligned. */ + if (sp & (16UL - 1)) + return false; + if (sp >= (base + sizeof(struct thread_info)) && sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) return true;