Skip to content
/ linux Public

Commit d58f8d4

Browse files
hodgesdsSasha Levin
authored andcommitted
tipc: fix RCU dereference race in tipc_aead_users_dec()
[ Upstream commit 6a65c0c ] 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: stable@vger.kernel.org Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Daniel Hodges <hodgesd@meta.com> Link: https://patch.msgid.link/20260203145621.17399-1-git@danielhodges.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ead66f2 commit d58f8d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)