Skip to content

Commit

Permalink
sparc64: Tighten checks in kstack_valid().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Feb 12, 2010
1 parent 440ab7a commit 232486e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/sparc/kernel/kstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 232486e

Please sign in to comment.