Skip to content

Commit a974b54

Browse files
Colin Ian KingKAGA-KOKO
authored andcommitted
futex: Return error code instead of assigning it without effect
The check on the rt_waiter and top_waiter->pi_state is assigning an error return code to ret but this later gets re-assigned, hence the check is ineffective. Return -EINVAL rather than assigning it to ret which was the original intent. Fixes: dc7109a ("futex: Validate waiter correctly in futex_proxy_trylock_atomic()") Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: André Almeida <andrealmeid@collabora.com> Link: https://lore.kernel.org/r/20210818131840.34262-1-colin.king@canonical.com
1 parent 15eb7c8 commit a974b54

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/futex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,7 @@ futex_proxy_trylock_atomic(u32 __user *pifutex, struct futex_hash_bucket *hb1,
20252025
* and waiting on the 'waitqueue' futex which is always !PI.
20262026
*/
20272027
if (!top_waiter->rt_waiter || top_waiter->pi_state)
2028-
ret = -EINVAL;
2028+
return -EINVAL;
20292029

20302030
/* Ensure we requeue to the expected futex. */
20312031
if (!match_futex(top_waiter->requeue_pi_key, key2))

0 commit comments

Comments
 (0)