[ 3.5.y.z extended stable ] Patch "klist: del waiter from klist_remove_waiters before wakeup" has been added to staging queue
Luis Henriques
luis.henriques at canonical.com
Tue Jun 11 09:21:30 UTC 2013
This is a note to let you know that I have just added a patch titled
klist: del waiter from klist_remove_waiters before wakeup
to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Luis
------
>From 65ef645449f12bf858306d5c1e2b07e2c20233cf Mon Sep 17 00:00:00 2001
From: "wang, biao" <biao.wang at intel.com>
Date: Thu, 16 May 2013 09:50:13 +0800
Subject: [PATCH] klist: del waiter from klist_remove_waiters before wakeup
waitting process
commit ac5a2962b02f57dea76d314ef2521a2170b28ab6 upstream.
There is a race between klist_remove and klist_release. klist_remove
uses a local var waiter saved on stack. When klist_release calls
wake_up_process(waiter->process) to wake up the waiter, waiter might run
immediately and reuse the stack. Then, klist_release calls
list_del(&waiter->list) to change previous
wait data and cause prior waiter thread corrupt.
The patch fixes it against kernel 3.9.
Signed-off-by: wang, biao <biao.wang at intel.com>
Acked-by: Peter Zijlstra <peterz at infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
lib/klist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/klist.c b/lib/klist.c
index 0874e41..358a368 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -193,10 +193,10 @@ static void klist_release(struct kref *kref)
if (waiter->node != n)
continue;
+ list_del(&waiter->list);
waiter->woken = 1;
mb();
wake_up_process(waiter->process);
- list_del(&waiter->list);
}
spin_unlock(&klist_remove_lock);
knode_set_klist(n, NULL);
--
1.8.1.2
More information about the kernel-team
mailing list