lkml.org 
[lkml]   [2007]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch-stable 1/3] rt-mutex: Fix stale return value
    Alexey Kuznetsov found some problems in the pi-futex code. 

    The major problem is a stale return value in rt_mutex_slowlock():

    When the pi chain walk returns -EDEADLK, but the waiter was woken up
    during the phases where the locks were dropped, the rtmutex could be
    acquired, but due to the stale return value -EDEADLK returned to the
    caller.

    Reset the return value in the woken up path.

    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Ingo Molnar <mingo@elte.hu>

    ---
    kernel/rtmutex.c | 11 +++++++++--
    1 file changed, 9 insertions(+), 2 deletions(-)

    Index: linux-2.6.21/kernel/rtmutex.c
    ===================================================================
    --- linux-2.6.21.orig/kernel/rtmutex.c 2007-06-08 11:56:10.000000000 +0200
    +++ linux-2.6.21/kernel/rtmutex.c 2007-06-08 11:56:10.000000000 +0200
    @@ -659,9 +659,16 @@ rt_mutex_slowlock(struct rt_mutex *lock,
    * all over without going into schedule to try
    * to get the lock now:
    */
    - if (unlikely(!waiter.task))
    + if (unlikely(!waiter.task)) {
    + /*
    + * Reset the return value. We might
    + * have returned with -EDEADLK and the
    + * owner released the lock while we
    + * were walking the pi chain.
    + */
    + ret = 0;
    continue;
    -
    + }
    if (unlikely(ret))
    break;
    }
    --

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-06-08 12:19    [W:0.021 / U:0.056 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site