Loading kernel/futex.c +18 −18 Original line number Diff line number Diff line Loading @@ -2411,8 +2411,8 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, } if (__rt_mutex_futex_trylock(&pi_state->pi_mutex)) { /* We got the lock after all, nothing to fix. */ ret = 0; /* We got the lock. pi_state is correct. Tell caller. */ ret = 1; goto out_unlock; } Loading Loading @@ -2440,7 +2440,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 = 0; ret = 1; goto out_unlock; } newowner = argowner; Loading Loading @@ -2486,7 +2486,7 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, raw_spin_unlock(&newowner->pi_lock); raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); return 0; return argowner == current; /* * In order to reschedule or handle a page fault, we need to drop the Loading Loading @@ -2528,7 +2528,7 @@ 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 = 0; ret = argowner == current; goto out_unlock; } Loading Loading @@ -2561,8 +2561,6 @@ static long futex_wait_restart(struct restart_block *restart); */ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) { int ret = 0; if (locked) { /* * Got the lock. We might not be the anticipated owner if we Loading @@ -2573,8 +2571,8 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) * stable state, anything else needs more attention. */ if (q->pi_state->owner != current) ret = fixup_pi_state_owner(uaddr, q, current); goto out; return fixup_pi_state_owner(uaddr, q, current); return 1; } /* Loading @@ -2585,24 +2583,21 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) * Another speculative read; pi_state->owner == current is unstable * but needs our attention. */ if (q->pi_state->owner == current) { ret = fixup_pi_state_owner(uaddr, q, NULL); goto out; } if (q->pi_state->owner == current) return fixup_pi_state_owner(uaddr, q, NULL); /* * Paranoia check. If we did not take the lock, then we should not be * the owner of the rt_mutex. */ if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) { printk(KERN_ERR "fixup_owner: ret = %d pi-mutex: %p " "pi-state %p\n", ret, printk(KERN_ERR "fixup_owner: pi-mutex: %p " "pi-state %p\n", q->pi_state->pi_mutex.owner, q->pi_state->owner); } out: return ret ? ret : locked; return 0; } /** Loading Loading @@ -3324,7 +3319,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, if (q.pi_state && (q.pi_state->owner != current)) { spin_lock(q.lock_ptr); ret = fixup_pi_state_owner(uaddr2, &q, current); if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) { if (ret < 0 && rt_mutex_owner(&q.pi_state->pi_mutex) == current) { pi_state = q.pi_state; get_pi_state(pi_state); } Loading @@ -3334,6 +3329,11 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, */ put_pi_state(q.pi_state); spin_unlock(q.lock_ptr); /* * Adjust the return value. It's either -EFAULT or * success (1) but the caller expects 0 for success. */ ret = ret < 0 ? ret : 0; } } else { struct rt_mutex *pi_mutex; Loading Loading
kernel/futex.c +18 −18 Original line number Diff line number Diff line Loading @@ -2411,8 +2411,8 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, } if (__rt_mutex_futex_trylock(&pi_state->pi_mutex)) { /* We got the lock after all, nothing to fix. */ ret = 0; /* We got the lock. pi_state is correct. Tell caller. */ ret = 1; goto out_unlock; } Loading Loading @@ -2440,7 +2440,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 = 0; ret = 1; goto out_unlock; } newowner = argowner; Loading Loading @@ -2486,7 +2486,7 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, raw_spin_unlock(&newowner->pi_lock); raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); return 0; return argowner == current; /* * In order to reschedule or handle a page fault, we need to drop the Loading Loading @@ -2528,7 +2528,7 @@ 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 = 0; ret = argowner == current; goto out_unlock; } Loading Loading @@ -2561,8 +2561,6 @@ static long futex_wait_restart(struct restart_block *restart); */ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) { int ret = 0; if (locked) { /* * Got the lock. We might not be the anticipated owner if we Loading @@ -2573,8 +2571,8 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) * stable state, anything else needs more attention. */ if (q->pi_state->owner != current) ret = fixup_pi_state_owner(uaddr, q, current); goto out; return fixup_pi_state_owner(uaddr, q, current); return 1; } /* Loading @@ -2585,24 +2583,21 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) * Another speculative read; pi_state->owner == current is unstable * but needs our attention. */ if (q->pi_state->owner == current) { ret = fixup_pi_state_owner(uaddr, q, NULL); goto out; } if (q->pi_state->owner == current) return fixup_pi_state_owner(uaddr, q, NULL); /* * Paranoia check. If we did not take the lock, then we should not be * the owner of the rt_mutex. */ if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) { printk(KERN_ERR "fixup_owner: ret = %d pi-mutex: %p " "pi-state %p\n", ret, printk(KERN_ERR "fixup_owner: pi-mutex: %p " "pi-state %p\n", q->pi_state->pi_mutex.owner, q->pi_state->owner); } out: return ret ? ret : locked; return 0; } /** Loading Loading @@ -3324,7 +3319,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, if (q.pi_state && (q.pi_state->owner != current)) { spin_lock(q.lock_ptr); ret = fixup_pi_state_owner(uaddr2, &q, current); if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) { if (ret < 0 && rt_mutex_owner(&q.pi_state->pi_mutex) == current) { pi_state = q.pi_state; get_pi_state(pi_state); } Loading @@ -3334,6 +3329,11 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, */ put_pi_state(q.pi_state); spin_unlock(q.lock_ptr); /* * Adjust the return value. It's either -EFAULT or * success (1) but the caller expects 0 for success. */ ret = ret < 0 ? ret : 0; } } else { struct rt_mutex *pi_mutex; Loading