alignment exceptionhandler sleeps in invalid context

Paul Mackerras paulus at samba.org
Fri Apr 28 21:02:39 EST 2006


Olaf Hering writes:

> I'm not sure where the bug is. Does it mean the network stack does
> something nasty, or is the exception handler itself broken? (probably the latter)
> This is 2.6.16.9 on a p270.

This patch should fix it, I hope.  If you can verify that it fixes it
I'll send it to Linus.

Paul.

diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index 3872e92..b02d858 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -179,7 +179,8 @@ do {								\
 #define __put_user_nocheck(x, ptr, size)			\
 ({								\
 	long __pu_err;						\
-	might_sleep();						\
+	if ((unsigned long)ptr < PAGE_OFFSET)			\
+		might_sleep();					\
 	__chk_user_ptr(ptr);					\
 	__put_user_size((x), (ptr), (size), __pu_err);		\
 	__pu_err;						\
@@ -259,7 +260,8 @@ ({								\
 	long __gu_err;						\
 	unsigned long __gu_val;					\
 	__chk_user_ptr(ptr);					\
-	might_sleep();						\
+	if ((unsigned long)ptr < PAGE_OFFSET)			\
+		might_sleep();					\
 	__get_user_size(__gu_val, (ptr), (size), __gu_err);	\
 	(x) = (__typeof__(*(ptr)))__gu_val;			\
 	__gu_err;						\
@@ -271,7 +273,8 @@ ({								\
 	long __gu_err;						\
 	long long __gu_val;					\
 	__chk_user_ptr(ptr);					\
-	might_sleep();						\
+	if ((unsigned long)ptr < PAGE_OFFSET)			\
+		might_sleep();					\
 	__get_user_size(__gu_val, (ptr), (size), __gu_err);	\
 	(x) = (__typeof__(*(ptr)))__gu_val;			\
 	__gu_err;						\



More information about the Linuxppc-dev mailing list