Skip to content

Commit 6a65c0c

Browse files
hodgesdskuba-moo
authored andcommitted
tipc: fix RCU dereference race in tipc_aead_users_dec()
tipc_aead_users_dec() calls rcu_dereference(aead) twice: once to store in 'tmp' for the NULL check, and again inside the atomic_add_unless() call. Use the already-dereferenced 'tmp' pointer consistently, matching the correct pattern used in tipc_aead_users_inc() and tipc_aead_users_set(). Fixes: fc1b6d6 ("tipc: introduce TIPC encryption & authentication") Cc: [email protected] Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Daniel Hodges <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 48dec8d commit 6a65c0c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/tipc/crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static void tipc_aead_users_dec(struct tipc_aead __rcu *aead, int lim)
460460
rcu_read_lock();
461461
tmp = rcu_dereference(aead);
462462
if (tmp)
463-
atomic_add_unless(&rcu_dereference(aead)->users, -1, lim);
463+
atomic_add_unless(&tmp->users, -1, lim);
464464
rcu_read_unlock();
465465
}
466466

0 commit comments

Comments
 (0)