Skip to contentSkip to conversation

tipc: fix RCU dereference race in tipc_aead_users_dec()

PATCH RESEND Applied Daniel Hodges 2 participants 2 messages Feb 3 – Feb 5

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 tipc: fix RCU dereference race in tipc_aead_users_dec()

From: Daniel Hodges <[email protected]>

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 fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication")
---
 net/tipc/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/crypto.c +1 -1
index 970db62bd029..a3f9ca28c3d5 100644
@@ -460,7 +460,7 @@ static void tipc_aead_users_dec(struct tipc_aead __rcu *aead, int lim)
 	rcu_read_lock();
 	tmp = rcu_dereference(aead);
 	if (tmp)
-		atomic_add_unless(&rcu_dereference(aead)->users, -1, lim);
+		atomic_add_unless(&tmp->users, -1, lim);
 	rcu_read_unlock();
 }
 
Signature · 1 line
2.52.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 3 Feb 2026 09:56:21 -0500 you wrote:

From: Daniel Hodges <[email protected]>

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().

[...]

Here is the summary with links:
- [RESEND] tipc: fix RCU dereference race in tipc_aead_users_dec()

    https://git.kernel.org/netdev/net/c/6a65c0cb0ff2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html