mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
klist: del waiter from klist_remove_waiters before wakeup waitting process
commit ac5a2962b0
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@intel.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
11e88c5e7b
commit
b6a526aa93
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue