@@ -674,7 +674,7 @@ static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb,
674
674
struct task_struct * task , int set_waiters )
675
675
{
676
676
int lock_taken , ret , ownerdied = 0 ;
677
- u32 uval , newval , curval ;
677
+ u32 uval , newval , curval , vpid = task_pid_vnr ( task ) ;
678
678
679
679
retry :
680
680
ret = lock_taken = 0 ;
@@ -684,7 +684,7 @@ static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb,
684
684
* (by doing a 0 -> TID atomic cmpxchg), while holding all
685
685
* the locks. It will most likely not succeed.
686
686
*/
687
- newval = task_pid_vnr ( task ) ;
687
+ newval = vpid ;
688
688
if (set_waiters )
689
689
newval |= FUTEX_WAITERS ;
690
690
@@ -696,7 +696,7 @@ static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb,
696
696
/*
697
697
* Detect deadlocks.
698
698
*/
699
- if ((unlikely ((curval & FUTEX_TID_MASK ) == task_pid_vnr ( task ) )))
699
+ if ((unlikely ((curval & FUTEX_TID_MASK ) == vpid )))
700
700
return - EDEADLK ;
701
701
702
702
/*
@@ -723,7 +723,7 @@ static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb,
723
723
*/
724
724
if (unlikely (ownerdied || !(curval & FUTEX_TID_MASK ))) {
725
725
/* Keep the OWNER_DIED bit */
726
- newval = (curval & ~FUTEX_TID_MASK ) | task_pid_vnr ( task ) ;
726
+ newval = (curval & ~FUTEX_TID_MASK ) | vpid ;
727
727
ownerdied = 0 ;
728
728
lock_taken = 1 ;
729
729
}
@@ -2047,9 +2047,9 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
2047
2047
{
2048
2048
struct futex_hash_bucket * hb ;
2049
2049
struct futex_q * this , * next ;
2050
- u32 uval ;
2051
2050
struct plist_head * head ;
2052
2051
union futex_key key = FUTEX_KEY_INIT ;
2052
+ u32 uval , vpid = task_pid_vnr (current );
2053
2053
int ret ;
2054
2054
2055
2055
retry :
@@ -2058,7 +2058,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
2058
2058
/*
2059
2059
* We release only a lock we actually own:
2060
2060
*/
2061
- if ((uval & FUTEX_TID_MASK ) != task_pid_vnr ( current ) )
2061
+ if ((uval & FUTEX_TID_MASK ) != vpid )
2062
2062
return - EPERM ;
2063
2063
2064
2064
ret = get_futex_key (uaddr , flags & FLAGS_SHARED , & key );
@@ -2074,7 +2074,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
2074
2074
* anyone else up:
2075
2075
*/
2076
2076
if (!(uval & FUTEX_OWNER_DIED ))
2077
- uval = cmpxchg_futex_value_locked (uaddr , task_pid_vnr ( current ) , 0 );
2077
+ uval = cmpxchg_futex_value_locked (uaddr , vpid , 0 );
2078
2078
2079
2079
2080
2080
if (unlikely (uval == - EFAULT ))
@@ -2083,7 +2083,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
2083
2083
* Rare case: we managed to release the lock atomically,
2084
2084
* no need to wake anyone else up:
2085
2085
*/
2086
- if (unlikely (uval == task_pid_vnr ( current ) ))
2086
+ if (unlikely (uval == vpid ))
2087
2087
goto out_unlock ;
2088
2088
2089
2089
/*
0 commit comments