Commit 47131c7c authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Greg Kroah-Hartman

ARM: 7913/1: fix framepointer check in unwind_frame

commit 3abb6671 upstream.

This patch fixes corner case when (fp + 4) overflows unsigned long,
for example: fp = 0xFFFFFFFF -> fp + 4 == 3.
Signed-off-by: default avatarKonstantin Khlebnikov <k.khlebnikov@samsung.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fa2ea62a
...@@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackframe *frame) ...@@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackframe *frame)
high = ALIGN(low, THREAD_SIZE); high = ALIGN(low, THREAD_SIZE);
/* check current frame pointer is within bounds */ /* check current frame pointer is within bounds */
if (fp < (low + 12) || fp + 4 >= high) if (fp < low + 12 || fp > high - 4)
return -EINVAL; return -EINVAL;
/* restore the registers from the stack frame */ /* restore the registers from the stack frame */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment