| Message ID | 20260722015638.1295-1-qingfang.deng@linux.dev |
|---|---|
| State | New |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:7000:508:b0:87c:c0c2:48b6 with SMTP id y8csp2633254mae;
Tue, 21 Jul 2026 18:57:21 -0700 (PDT)
X-Forwarded-Encrypted: i=2;
AHgh+RpmCob0Yh9L5p9CwcB0BOuKCC5bdIyFHiBgE4bokO6iXlcv5yZim1H1W6+C1vIIDa/eIYN1EP6hlHU=@openvpn.net
X-Received: by 2002:a05:6830:6f4c:b0:7dc:2f4f:17b4 with SMTP id
46e09a7af769-7eda08f4ed2mr11299298a34.21.1784685441254;
Tue, 21 Jul 2026 18:57:21 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1784685441; cv=none;
d=google.com; s=arc-20260327;
b=n2avbYcT7w897eh/3FATh0tNLNPP2ZTTcrKNhtDnqrFDxXICTzBs/ts1/+0Sba+jHI
Q1T/xJKZAnb3AWOF6OyJdXFsWJl/asrcbsPcNC8lqBW0TZxvNqPfS0Ia5PST+VS1XQa3
BPcIQRm2hyLBfmWxxJ3avW5Yf9oYLqd0cjk4/XaV8EkrGkgGy48gisZ7X5BUUJFI+BlO
slBckYcM/dkoDmZ5+jmXvf0wDnyGShPZpSxYOwtAfcqKEd1w9tIPYVD0ysttB+LibP0k
4cakrwofhadO0oaZLivLlcXIaqDTsWPI9NQfUJmTxyeFuknYOxoO9n/ujeiP7zO4U6/6
LJ4Q==
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:message-id:date:to:from:dkim-signature:dkim-signature
:dkim-signature:dkim-signature;
bh=6kyPGNpIF8nzLgELehr4/gMw5QdBLgeVub+sUsAihnE=;
fh=/o3GmUKd8Dh0vGZwH4EdzFFKZ+kMJbBWria5gx9unLk=;
b=mJQdrrYMRGW+TQUl2S3kpagXCASKYzEGbw8QuZM+ImdVJokdz4KCg+QLjy8b8UGtrA
8cAgtX1La8eXZTB9fLRiVXy858SfP96tQNVjkjFxmwwkMsWfKiGscqifYt6JIehfvbIm
9E9+7WP4Pba8/Ka5iwaN8OZJWyYE3bvZoavFuR8t6lFjHN4rO4kZUFK8SqI9ZXdCyGrm
kN+tzMRxh7dKcS62tSD6OLM5StXmrZsYvL+CW/tqQyQrjVCMW8zN2rBFCyHmbsPMYdju
UJNsLdgTkDRc/aHHAbjQ5utTelwt6bDDYbgBHSyGi3cPgJz9wkA5mFzH5566sN0dPLaG
jSNw==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=J9to6wJZ;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=HgDj9SJX;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=iHo6xhls;
dkim=neutral (body hash did not verify) header.i=@linux.dev
header.s=key1 header.b=ZeDQ2qwN;
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;
dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev
Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7])
by mx.google.com with ESMTPS id
46e09a7af769-7ee29e2482esi337039a34.60.2026.07.21.18.57.20
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 21 Jul 2026 18:57:21 -0700 (PDT)
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=J9to6wJZ;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=HgDj9SJX;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=iHo6xhls;
dkim=neutral (body hash did not verify) header.i=@linux.dev
header.s=key1 header.b=ZeDQ2qwN;
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;
dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev
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: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:In-Reply-To:References:List-Owner;
bh=6kyPGNpIF8nzLgELehr4/gMw5QdBLgeVub+sUsAihnE=; b=J9to6wJZoGEMkUmSbgH6KBxoW0
1Leyl8vYCKoEBTOy3gNiyAAfF2jK39V+RoQkcOY9X07+lYhKWtoc1mBc+dFwpnYFT0xZeFPAsKB+Z
ajSE7So/GGhmJswGXqZwyHr1RJVqPVR/v9Hdm1P/RunpP3RPurEiZLjfY1n7YhpZwBX0=;
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.95)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1wmMCv-00018u-BS;
Wed, 22 Jul 2026 01:57:14 +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.95)
(envelope-from <qingfang.deng@linux.dev>) id 1wmMCt-00018l-EI
for openvpn-devel@lists.sourceforge.net;
Wed, 22 Jul 2026 01:57:12 +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:Message-ID:
Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
List-Subscribe:List-Post:List-Owner:List-Archive;
bh=JLtLRoKFRx5lDX8JA7MpyCYkGwrphsvGUcvl4yquHA0=; b=HgDj9SJXXIHutcxf8zpj3Wzrbk
N2MZEzAoY3oZHq2S1Fb/jOqnCeso9pqELYWrjkj+oOeQQa7LzI4czsG4osJpjZbqCEo7hZDyzegN6
CKc/ufXIUqKtK9raKfjfcJ+HIG22mkBPg0AwZyoo6wMv1KtnPyYq1Oy6Lw/LsVKck33M=;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x
;
h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From
:Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:
Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:
References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:
List-Owner:List-Archive; bh=JLtLRoKFRx5lDX8JA7MpyCYkGwrphsvGUcvl4yquHA0=; b=i
Ho6xhlslFeWRjoJiwrseEKeRInckd233TZl4O9ZNqAbGBIsEGBPc8ONxuvl6rdtA5GG1GdnAjdLdc
mahrrKEGOVJCRvt0zqt0Aho8X1sDb39hlPJhCwVhw7KI2VvCTAsH7g5ExbzkDByaYFGqZVlqrsNB4
rcv/krPbYGQ7+upU=;
Received: from out-188.mta0.migadu.com ([91.218.175.188])
by sfi-mx-2.v28.lw.sourceforge.com with esmtps
(TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95)
id 1wmMCq-0002Tj-FG for openvpn-devel@lists.sourceforge.net;
Wed, 22 Jul 2026 01:57:12 +0000
X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and
include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1;
t=1784685416;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding;
bh=JLtLRoKFRx5lDX8JA7MpyCYkGwrphsvGUcvl4yquHA0=;
b=ZeDQ2qwNwKnBRSWgX5i0uoCHuLzdkwBUxk22PgaxvDFc2VuMkPmlKBj9p7B2p1r/mN+Dr0
yh70T4wR2OsMPBtLuwf2j54S06oWYrSut6k2lMRQeUZiS69/c4zrN82gJgjg4pg+yXx6jY
0sn9xgL5OsZGE+n6YJd6CwzrAM6xIfI=
From: Qingfang Deng <qingfang.deng@linux.dev>
To: openvpn-devel@lists.sourceforge.net,
Antonio Quartulli <antonio@openvpn.net>
Date: Wed, 22 Jul 2026 09:56:38 +0800
Message-ID: <20260722015638.1295-1-qingfang.deng@linux.dev>
MIME-Version: 1.0
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.2 (/)
X-Spam-Report: Spam detection software,
running on the system "sfi-spamd-2.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: rcu_access_pointer() should only be used to test the value
of a pointer, not to dereference it. Use rcu_dereference() instead. No extra
rcu_read_lock() is needed here, as the spin_lock_bh() above mark [...]
Content analysis details: (0.2 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
0.1 DKIM_INVALID DKIM or DK signature exists, but is not valid
X-Headers-End: 1wmMCq-0002Tj-FG
Subject: [Openvpn-devel] [PATCH ovpn-net] ovpn: fix incorrect use of
rcu_access_pointer()
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: 1871378321124766957
X-GMAIL-MSGID: 1871378321124766957
|
| Series |
[Openvpn-devel,ovpn-net] ovpn: fix incorrect use of rcu_access_pointer()
|
|
Commit Message
Qingfang Deng
July 22, 2026, 1:56 a.m. UTC
rcu_access_pointer() should only be used to test the value of a pointer,
not to dereference it. Use rcu_dereference() instead. No extra
rcu_read_lock() is needed here, as the spin_lock_bh() above marks an RCU
critical section.
Fixes: f6226ae7a0cd ("ovpn: introduce the ovpn_socket object")
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
drivers/net/ovpn/peer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi! On 22/07/2026 03:56, Qingfang Deng wrote: > rcu_access_pointer() should only be used to test the value of a pointer, > not to dereference it. Use rcu_dereference() instead. No extra > rcu_read_lock() is needed here, as the spin_lock_bh() above marks an RCU > critical section. > > Fixes: f6226ae7a0cd ("ovpn: introduce the ovpn_socket object") > Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev> > --- > drivers/net/ovpn/peer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c > index a09d61296425..8de737579112 100644 > --- a/drivers/net/ovpn/peer.c > +++ b/drivers/net/ovpn/peer.c > @@ -1164,7 +1164,7 @@ static void ovpn_peer_release_p2p(struct ovpn_priv *ovpn, struct sock *sk, > } > > if (sk) { > - ovpn_sock = rcu_access_pointer(peer->sock); > + ovpn_sock = rcu_dereference(peer->sock); Sashiko says: Using `rcu_dereference()` instead of `rcu_dereference_bh()` under `spin_lock_bh()` triggers a lockdep warning.
diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c index a09d61296425..8de737579112 100644 --- a/drivers/net/ovpn/peer.c +++ b/drivers/net/ovpn/peer.c @@ -1164,7 +1164,7 @@ static void ovpn_peer_release_p2p(struct ovpn_priv *ovpn, struct sock *sk, } if (sk) { - ovpn_sock = rcu_access_pointer(peer->sock); + ovpn_sock = rcu_dereference(peer->sock); if (!ovpn_sock || ovpn_sock->sk != sk) { spin_unlock_bh(&ovpn->lock); ovpn_peer_put(peer);