lkml.org 
[lkml]   [2017]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;


\
 
 \ /
  Last update: 2017-03-07 19:03    [W:0.049 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site