[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260201022128.2658251-1-hodgesd@meta.com>
Date: Sat, 31 Jan 2026 18:21:28 -0800
From: Daniel Hodges <hodgesd@...a.com>
To: Jon Maloy <jmaloy@...hat.com>, "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo
Abeni <pabeni@...hat.com>
CC: Simon Horman <horms@...nel.org>, Ying Xue <ying.xue@...dreiver.com>,
Tuong
Lien <tuong.t.lien@...tech.com.au>, <netdev@...r.kernel.org>,
<tipc-discussion@...ts.sourceforge.net>,
<linux-kernel@...r.kernel.org>, Daniel Hodges <hodgesd@...a.com>,
<stable@...r.kernel.org>
Subject: [PATCH] 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: fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication")
Cc: stable@...r.kernel.org
Signed-off-by: Daniel Hodges <hodgesd@...a.com>
---
net/tipc/crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index 970db62bd029..a3f9ca28c3d5 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -453,21 +453,21 @@ static void tipc_aead_users_inc(struct tipc_aead __rcu *aead, int lim)
rcu_read_unlock();
}
static void tipc_aead_users_dec(struct tipc_aead __rcu *aead, int lim)
{
struct tipc_aead *tmp;
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();
}
static void tipc_aead_users_set(struct tipc_aead __rcu *aead, int val)
{
struct tipc_aead *tmp;
int cur;
rcu_read_lock();
tmp = rcu_dereference(aead);
--
2.47.3
Powered by blists - more mailing lists