[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200703011606.47776.rjw@sisk.pl>
Date: Thu, 1 Mar 2007 16:06:46 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Andrew Morton <akpm@...l.org>
Cc: Pavel Machek <pavel@....cz>, LKML <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...sign.ru>,
Aneesh Kumar <aneesh.kumar@...il.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Srivatsa Vaddagiri <vatsa@...ibm.com>,
Gautham R Shenoy <ego@...ibm.com>
Subject: [PATCH -mm 1/7] Freezer: Read PF_BORROWED_MM in a nonracy way
From: Rafael J. Wysocki <rjw@...k.pl>
The reading of PF_BORROWED_MM in is_user_space() without task_lock() is racy.
Fix it.
Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
Acked-by: Pavel Machek <pavel@....cz>
---
kernel/power/process.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Index: linux-2.6.20-mm2/kernel/power/process.c
===================================================================
--- linux-2.6.20-mm2.orig/kernel/power/process.c 2007-02-25 14:02:55.000000000 +0100
+++ linux-2.6.20-mm2/kernel/power/process.c 2007-02-25 14:03:51.000000000 +0100
@@ -8,6 +8,7 @@
#undef DEBUG
+#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/suspend.h>
@@ -87,7 +88,12 @@ static void cancel_freezing(struct task_
static inline int is_user_space(struct task_struct *p)
{
- return p->mm && !(p->flags & PF_BORROWED_MM);
+ int ret;
+
+ task_lock(p);
+ ret = p->mm && !(p->flags & PF_BORROWED_MM);
+ task_unlock(p);
+ return ret;
}
static unsigned int try_to_freeze_tasks(int freeze_user_space)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists