Subject: + 
lib-klistc-del-waiter-from-klist_remove_waiters-before-waking-waiting-process.patch
 added to -mm tree
To: 
[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 21 May 2013 13:54:00 -0700


The patch titled
     Subject: lib/klist.c: del waiter from klist_remove_waiters before waking 
waiting process
has been added to the -mm tree.  Its filename is
     
lib-klistc-del-waiter-from-klist_remove_waiters-before-waking-waiting-process.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: "wang, biao" <[email protected]>
Subject: lib/klist.c: del waiter from klist_remove_waiters before waking 
waiting process

There is a race between klist_remove() and klist_release().

klist_remove() uses a local var `waiter' stored on the stack.  When
klist_release() calls wake_up_process(waiter->process) to wake up the
waiter, the waiter might run immediately and reuse the stack.  Then,
klist_release() calls list_del(&waiter->list) to change previous wait data
and causes corruption in the waiting thread's stack area.

Signed-off-by: wang, biao <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Cc: "Zhang, Yanmin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 lib/klist.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
lib/klist.c~lib-klistc-del-waiter-from-klist_remove_waiters-before-waking-waiting-process
 lib/klist.c
--- 
a/lib/klist.c~lib-klistc-del-waiter-from-klist_remove_waiters-before-waking-waiting-process
+++ a/lib/klist.c
@@ -193,10 +193,10 @@ static void klist_release(struct kref *k
                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);
_

Patches currently in -mm which might be from [email protected] are

lib-klistc-del-waiter-from-klist_remove_waiters-before-waking-waiting-process.patch

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to