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>
This commit is contained in:
David S. Miller 2010-02-12 12:03:45 -08:00
parent 440ab7ac2d
commit 232486e1e9
1 changed files with 4 additions and 0 deletions

View File

@ -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;