Loading kernel/futex.c +26 −27 Original line number Diff line number Diff line Loading @@ -2329,18 +2329,13 @@ static void unqueue_me_pi(struct futex_q *q) spin_unlock(q->lock_ptr); } static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, struct task_struct *argowner) { struct futex_pi_state *pi_state = q->pi_state; u32 uval, curval, newval; struct task_struct *oldowner, *newowner; u32 newtid; int ret, err = 0; lockdep_assert_held(q->lock_ptr); raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); u32 uval, curval, newval, newtid; int err = 0; oldowner = pi_state->owner; Loading Loading @@ -2374,14 +2369,12 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, * We raced against a concurrent self; things are * already fixed up. Nothing to do. */ ret = 0; goto out_unlock; return 0; } if (__rt_mutex_futex_trylock(&pi_state->pi_mutex)) { /* We got the lock. pi_state is correct. Tell caller. */ ret = 1; goto out_unlock; return 1; } /* Loading @@ -2408,8 +2401,7 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, * We raced against a concurrent self; things are * already fixed up. Nothing to do. */ ret = 1; goto out_unlock; return 1; } newowner = argowner; } Loading Loading @@ -2440,7 +2432,6 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, * itself. */ pi_state_update_owner(pi_state, newowner); raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); return argowner == current; Loading @@ -2463,17 +2454,16 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, switch (err) { case -EFAULT: ret = fault_in_user_writeable(uaddr); err = fault_in_user_writeable(uaddr); break; case -EAGAIN: cond_resched(); ret = 0; err = 0; break; default: WARN_ON_ONCE(1); ret = err; break; } Loading @@ -2483,17 +2473,26 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, /* * Check if someone else fixed it for us: */ if (pi_state->owner != oldowner) { ret = argowner == current; goto out_unlock; if (pi_state->owner != oldowner) return argowner == current; /* Retry if err was -EAGAIN or the fault in succeeded */ if (!err) goto retry; return err; } if (ret) goto out_unlock; static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, struct task_struct *argowner) { struct futex_pi_state *pi_state = q->pi_state; int ret; goto retry; lockdep_assert_held(q->lock_ptr); out_unlock: raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); ret = __fixup_pi_state_owner(uaddr, q, argowner); raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); return ret; } Loading Loading
kernel/futex.c +26 −27 Original line number Diff line number Diff line Loading @@ -2329,18 +2329,13 @@ static void unqueue_me_pi(struct futex_q *q) spin_unlock(q->lock_ptr); } static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, struct task_struct *argowner) { struct futex_pi_state *pi_state = q->pi_state; u32 uval, curval, newval; struct task_struct *oldowner, *newowner; u32 newtid; int ret, err = 0; lockdep_assert_held(q->lock_ptr); raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); u32 uval, curval, newval, newtid; int err = 0; oldowner = pi_state->owner; Loading Loading @@ -2374,14 +2369,12 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, * We raced against a concurrent self; things are * already fixed up. Nothing to do. */ ret = 0; goto out_unlock; return 0; } if (__rt_mutex_futex_trylock(&pi_state->pi_mutex)) { /* We got the lock. pi_state is correct. Tell caller. */ ret = 1; goto out_unlock; return 1; } /* Loading @@ -2408,8 +2401,7 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, * We raced against a concurrent self; things are * already fixed up. Nothing to do. */ ret = 1; goto out_unlock; return 1; } newowner = argowner; } Loading Loading @@ -2440,7 +2432,6 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, * itself. */ pi_state_update_owner(pi_state, newowner); raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); return argowner == current; Loading @@ -2463,17 +2454,16 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, switch (err) { case -EFAULT: ret = fault_in_user_writeable(uaddr); err = fault_in_user_writeable(uaddr); break; case -EAGAIN: cond_resched(); ret = 0; err = 0; break; default: WARN_ON_ONCE(1); ret = err; break; } Loading @@ -2483,17 +2473,26 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, /* * Check if someone else fixed it for us: */ if (pi_state->owner != oldowner) { ret = argowner == current; goto out_unlock; if (pi_state->owner != oldowner) return argowner == current; /* Retry if err was -EAGAIN or the fault in succeeded */ if (!err) goto retry; return err; } if (ret) goto out_unlock; static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, struct task_struct *argowner) { struct futex_pi_state *pi_state = q->pi_state; int ret; goto retry; lockdep_assert_held(q->lock_ptr); out_unlock: raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); ret = __fixup_pi_state_owner(uaddr, q, argowner); raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); return ret; } Loading