summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-02-12 12:03:45 -0800
committerDavid S. Miller <davem@davemloft.net>2010-02-12 12:03:45 -0800
commit232486e1e9f34889424b68ee6270440b554479a2 (patch)
tree146eefb55c19b9cc21f0263ffa19f2e6a5e707fe /arch
parent440ab7ac2d6b735fb278a1ff1674f6716314c6bb (diff)
downloadlinux-3.10-232486e1e9f34889424b68ee6270440b554479a2.tar.gz
linux-3.10-232486e1e9f34889424b68ee6270440b554479a2.tar.bz2
linux-3.10-232486e1e9f34889424b68ee6270440b554479a2.zip
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 <mroos@linux.ee> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/kstack.h4
1 files changed, 4 insertions, 0 deletions
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;