diff options
author | David S. Miller <davem@davemloft.net> | 2010-02-12 15:03:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-12 15:03:45 -0500 |
commit | 232486e1e9f34889424b68ee6270440b554479a2 (patch) | |
tree | 146eefb55c19b9cc21f0263ffa19f2e6a5e707fe /arch/sparc | |
parent | 440ab7ac2d6b735fb278a1ff1674f6716314c6bb (diff) |
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/sparc')
-rw-r--r-- | arch/sparc/kernel/kstack.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/sparc/kernel/kstack.h b/arch/sparc/kernel/kstack.h index 4248d969272f..5247283d1c03 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) | |||
11 | { | 11 | { |
12 | unsigned long base = (unsigned long) tp; | 12 | unsigned long base = (unsigned long) tp; |
13 | 13 | ||
14 | /* Stack pointer must be 16-byte aligned. */ | ||
15 | if (sp & (16UL - 1)) | ||
16 | return false; | ||
17 | |||
14 | if (sp >= (base + sizeof(struct thread_info)) && | 18 | if (sp >= (base + sizeof(struct thread_info)) && |
15 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | 19 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) |
16 | return true; | 20 | return true; |