[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170307180158.GG3312@twins.programming.kicks-ass.net>
Date: Tue, 7 Mar 2017 19:01:58 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Thomas Gleixner <tglx@...utronix.de>, mingo@...nel.org,
juri.lelli@....com, rostedt@...dmis.org, xlpang@...hat.com,
linux-kernel@...r.kernel.org, mathieu.desnoyers@...icios.com,
jdesfossez@...icios.com, bristot@...hat.com, dvhart@...radead.org
Subject: Re: [PATCH -v5 07/14] futex: Change locking rules
On Tue, Mar 07, 2017 at 05:47:44PM +0100, Sebastian Andrzej Siewior wrote:
> On 2017-03-07 14:22:14 [+0100], Thomas Gleixner wrote:
> > Both 'return' statements leak &pi_state->pi_mutex.wait_lock ....
>
> this has unlock in both 'return's.
> handle_fault:
> + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
> spin_unlock(q->lock_ptr);
>
> ret = fault_in_user_writeable(uaddr);
>
> spin_lock(q->lock_ptr);
> + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
>
> /*
> * Check if someone else fixed it for us:
> */
> - if (pi_state->owner != oldowner)
> + if (pi_state->owner != oldowner) {
> + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
> return 0;
> + }
>
> - if (ret)
> + if (ret) {
> + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
> return ret;
> + }
>
> goto retry;
> }
I had locally already fixed it with a common:
out_unlock:
raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
return ret;
Powered by blists - more mailing lists