[Openvpn-devel,net-next,1/3] ovpn: use the right RCU primitive in ovpn_crypto_kill_key
| Message ID | 23e0c4d292f834bdf1efc5bb14ee20519409a61a.1795704654.git.ralf@mandelbit.com |
|---|---|
| State | New |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id
tl9-n1csp7337846lad;
Thu, 26 Nov 2026 07:15:53 -0800 (PST)
X-Forwarded-Encrypted: i=2;
AL+hErEy9WnqKH8/1Y2Y0xnd0GJk6p054271DvERWH8m2tTVCFk37fz5eSw+h4GEW5v5N86jYAfySahNU5k=@openvpn.net
X-Received: by 2002:a17:903:2c50:b0:2e9:460e:ca57 with SMTP id
d9443c01a7336-2f03f17d214mr210955355ad.15.1795706152764;
Thu, 26 Nov 2026 07:15:52 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1795706152; cv=none;
d=google.com; s=arc-20260327;
b=qk8LFrsPxf1JoIarfvexXHQJ83iN9CLGEC+gXvvr4yoUXms5IB81diDhgtOkv9wsPS
vJYYVOCKDcK4qIqLFhlUiQhMQzEIApNJXVtc10O9QPA4dLkuvMLf4YKJ92pGxIpcVRTK
XdmV2HJf78dSfJLUXYUnvLyYGBrp36H++rNN4rT+vokgpIgNNB7VLsrdrkwKUa5oZXUO
67rH/m6fpgsMadtZShJvzSeh+PaPhiNttsW+JwaVUSGS4GzGsI8DTv6ioJqQw6wBvgD6
mTxx9e262rGGJiuQcmi6hhudaFjLg1ZJLEMRzMDGs8eMyc5F3M/sTjMcFbCl9kVGM5ZV
EibQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=errors-to:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:dkim-signature:dkim-signature:dkim-signature:dkim-signature;
bh=MJB6whLGufjdjC+/5Mkw6bZVvvZRKJH5sSHdUU5nHlM=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=oCDpGWO8MDKrTNVsZC0JVxOrUDEcXL/RqFmqec1vHDswQ0stywDZI63xlZJzD2IHoz
7VBns40dv1vw2/8ydXTgrdxSbwVBBYWyL87y+UOdQP/QSYHoEk6Opt4fRQjyQFPrtOnN
9xuwXSvDWmNTmgV1w7IaQV7Dy+a2MLisiyKwWKW8evfU+eGEHDAlgi5oQoShfTJWzcIv
Wn5zmsaBo7LtRkBH98Ob7pMHRqJ4+ZfR6GqNUrRTP8TypD1ZFm1a8Ft4eAI2jcjsz0I+
f32+DDFTB6IGTn/qKtoX3ZTBLpm9vUDwXxhlLZsLG57iJY3SEDlfgaUN3x3aqAd8U0+q
wvGQ==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=l5etA1e6;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=WT8RN7xn;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=VQ9WevLh;
dkim=neutral (body hash did not verify) header.i=@mandelbit.com
header.s=MBO0001 header.b="n7Yc/X5G";
spf=pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net
Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7])
by mx.google.com with ESMTPS id
41be03b00d2f7-cdebefabf22si4754901a12.304.2026.11.26.07.15.52
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Thu, 26 Nov 2026 07:15:52 -0800 (PST)
Received-SPF: pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) client-ip=216.105.38.7;
Authentication-Results: mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=l5etA1e6;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=WT8RN7xn;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=VQ9WevLh;
dkim=neutral (body hash did not verify) header.i=@mandelbit.com
header.s=MBO0001 header.b="n7Yc/X5G";
spf=pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:
List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:
Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender:
Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post:
List-Owner; bh=MJB6whLGufjdjC+/5Mkw6bZVvvZRKJH5sSHdUU5nHlM=; b=l5etA1e68HD0O8
uqdIwMoZz12LCxez7l138RbhJ1/OpMcpL4T2uQr09ma022DowB7+qIAJFl1S717nEklzyFhsa5DwS
dei6ksp4XZUJWhIaC4Cu8kg5fkc8FM5ArACfvLtgajbu+ic+2auI3IqarKrVA3MUEgmaylmY83u+L
r4s=;
Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com)
by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.100.1)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1xWbCR-000000007H7-2z23;
Thu, 26 Nov 2026 15:15:51 +0000
Received: from [172.30.29.66] (helo=mx.sourceforge.net)
by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1)
(envelope-from <ralf@mandelbit.com>) id 1xWbCO-000000007Gl-26Kp
for openvpn-devel@lists.sourceforge.net;
Thu, 26 Nov 2026 15:15:48 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References:
In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:
Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive;
bh=JAAOeM4yhAAFzqs5RnbFYA5UAvmr7w2WFlTxu1tVPzI=; b=WT8RN7xnz83zuK3B4k+qG12u4c
snTdeoAzwGcEMZAB6alOAsAPiN24EA11gPcTM68Zx/ad2B+nX4fmrS9s8RLGGtT2J2vm93BLU6WOY
p4Ao0sRAhAe8JqHhIIXem6UK88s3mkkO+7bw1EAE/M/s6GrIwhhhr8+1YSzqxTyqpstM=;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x
;
h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:
Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post:
List-Subscribe:List-Post:List-Owner:List-Archive;
bh=JAAOeM4yhAAFzqs5RnbFYA5UAvmr7w2WFlTxu1tVPzI=; b=VQ9WevLh1HZ9/Sb8qfSEbgvay3
vl6HWHH7X1h2/CZUZAhK1hvDUKoFbsx2lxgNuAvUCtatyi0jS2HlsiQ8sBHzY9g/B3BEnUqklSn71
qB8ttg1siZGrYMhc74OdYGiUXCC7ya7eUYmEorFA1GM006X5/r+L0E1nUlHX3jK/aWf4=;
Received: from mout-b-210.mailbox.org ([195.10.208.40])
by sfi-mx-1.v28.lw.sourceforge.com with esmtps
(TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1)
id 1xWbCM-000000002ac-2PLp for openvpn-devel@lists.sourceforge.net;
Thu, 26 Nov 2026 15:15:48 +0000
Received: from smtp202.mailbox.org (smtp202.mailbox.org
[IPv6:2001:67c:2050:b231:465::202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits)
server-digest
SHA256) (No client certificate requested)
by mout-b-210.mailbox.org (Postfix) with ESMTPS id 4jb0VK51VmzFqcZ
for <openvpn-devel@lists.sourceforge.net>;
Thu, 26 Nov 2026 16:15:37 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
s=MBO0001; t=1795706137;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=JAAOeM4yhAAFzqs5RnbFYA5UAvmr7w2WFlTxu1tVPzI=;
b=n7Yc/X5GYuaqSBVsH5sAjMYgRnaIGO+K4Ne45UkAx5J6a04nfH2RybYKmQ18fEKgqY3a6q
TTYM7u/0fGGoNbs6CWIsSc5tliq3WRBAEgrVZ1s8Nj4e8ilg5INV/OvyOsyEqmFMtpswMJ
2olzxjjkKuIEmwyG7jXWumrQb/VckCA4Vtq8rvs/uvhQE4xbmwB9U0N4L2MqpcNu8cUw9j
d04mo3Xo0MeXn5wy9A9YqMto06MmKbQfE1JJuDBDzCRGsKRjymRU5i6TCL6FnWr+wokloU
CXFa5Ws+77yr2wfDwxB/0AMDB2Uq0+TTRo4NRrxhR6Mn2UMFkEl01nZoo4NDBQ==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates
2001:67c:2050:b231:465::202 as permitted sender)
smtp.mailfrom=ralf@mandelbit.com
From: Ralf Lici <ralf@mandelbit.com>
To: openvpn-devel@lists.sourceforge.net
Date: Thu, 26 Nov 2026 16:15:23 +0100
Message-ID:
<23e0c4d292f834bdf1efc5bb14ee20519409a61a.1795704654.git.ralf@mandelbit.com>
X-Mailer: git-send-email 2.56.0
In-Reply-To: <cover.1795704654.git.ralf@mandelbit.com>
References: <cover.1795704654.git.ralf@mandelbit.com>
MIME-Version: 1.0
X-Rspamd-Queue-Id: 4jb0VK51VmzFqcZ
X-Spam-Score: -0.2 (/)
X-Spam-Report: Spam detection software,
running on the system "sfi-spamd-1.hosts.colo.sdot.me",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: The kdoc for rcu_access_pointer says it is meant for cases
where the pointer value is used but not dereferenced,
that rcu_dereference_protected
should be used when update-side locks prevent the pointe [...]
Content analysis details: (-0.2 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
X-Headers-End: 1xWbCM-000000002ac-2PLp
Subject: [Openvpn-devel] [PATCH ovpn net-next 1/3] ovpn: use the right RCU
primitive in ovpn_crypto_kill_key
X-BeenThere: openvpn-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: openvpn-devel-bounces@lists.sourceforge.net
X-getmail-retrieved-from-mailbox: Inbox
X-GMAIL-THRID: 1882934374604631227
X-GMAIL-MSGID: 1882934374604631227
|
| Series |
ovpn: assorted cleanups
|
|
Commit Message
Ralf Lici
Nov. 26, 2026, 3:15 p.m. UTC
The kdoc for rcu_access_pointer says it is meant for cases where the
pointer value is used but not dereferenced, that
rcu_dereference_protected should be used when update-side locks prevent
the pointer from changing, and that assigning the rcu_access_pointer
return value to a local variable "results in an accident waiting to
happen".
Swap rcu_access_pointer with rcu_dereference_protected in
ovpn_crypto_kill_key, adopting the same pattern of
ovpn_crypto_key_slots_swap.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260809212142.2249027-1-antonio%40openvpn.net?part=1
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
drivers/net/ovpn/crypto.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ovpn/crypto.c b/drivers/net/ovpn/crypto.c index 7e545428900a..cec39147e011 100644 --- a/drivers/net/ovpn/crypto.c +++ b/drivers/net/ovpn/crypto.c @@ -54,10 +54,12 @@ bool ovpn_crypto_kill_key(struct ovpn_crypto_state *cs, u8 key_id) int slot = 0; spin_lock_bh(&cs->lock); - tmp = rcu_access_pointer(cs->slots[slot]); + tmp = rcu_dereference_protected(cs->slots[slot], + lockdep_is_held(&cs->lock)); if (!tmp || tmp->key_id != key_id) { slot = 1; - tmp = rcu_access_pointer(cs->slots[slot]); + tmp = rcu_dereference_protected(cs->slots[slot], + lockdep_is_held(&cs->lock)); } if (tmp && tmp->key_id == key_id)