From patchwork Wed Apr 30 12:32:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 4232 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:31a6:b0:656:592e:a137 with SMTP id u6csp868713mac; Wed, 30 Apr 2025 05:51:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCULEsIlsREPzxynpbhwj20ZUlCH4HRagRHcf3HEg1wX8Jv1x4cPX2rvblIh4EfuPKLo5NyyKgNyd3s=@openvpn.net X-Google-Smtp-Source: AGHT+IHpSLBXj4rnv4Nsl7jPtk8V60UDbeE9kg8akzUJ5P1FDzjY4dpArf7yaN1RmaCRJysakQqy X-Received: by 2002:a05:6e02:3712:b0:3d8:8900:9a30 with SMTP id e9e14a558f8ab-3d9677220camr32846935ab.20.1746017495920; Wed, 30 Apr 2025 05:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746017495; cv=none; d=google.com; s=arc-20240605; b=IvzLCuSaEDyorhFsgLm63n/8YdhDEs1zgsc5RTJvpCHOiEF6rRNVkW2SCocMfYq+M5 SksC0FG2t/qYJpFnLTSKwe89JUeFhOGWhlWSlNDhf2Ys96PaaR7duz6VfmnDz/mUhAoO 6LtLWnXZr7foS4G6rjGjL0pZlCjXk6GM3yPR/sPqouVZb8w4/85ZD1xdJcXEYnJuwK3t k8LRM/4PcsDgOlqPDoG3ry7Fu7BgMJvJ2UcOIEKhWRVw8NQg06ahsD9DF8buX3JMmKER oX0rSU1R+vZLAMGCDApH5g1r8wzHnQeb6SIw4IXZJUYLakUhuz49wnr6mwu8PP5ukA8V UW5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:cc: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=V90tuVMbfQeDw8EJ73n6qy/VTB95qodZIzMBKMoH7dI=; fh=BEXsVF2vhWxaMgs2qFKAWZUkW8vXXdGeO1y9DIa+eNM=; b=jCyjOEpr5JQ5ma0ap1zIcsBBMfA5FCP4oc1nLqTyByV4d+CtACyIM2iuDlxBoEd8a/ qWKgd7ihs1dqSMu3FafwQpKxdKma3lOwYtHcmjVfdJ7K35z6ToLaijUgMfrHzZbnXxmi U0Irv1886Z5crIDGRDKlMlhacWYotKmvKUaH4nDO4Q+ddRGN06ehphsxFZE1fYEiy78f 91mMMsQjZrFQrrhZfXOBsVXHbOeGZG624G4cMfXIs8MSeWlcnOH0Yx+ZH6iC6aECwXEM 5IaUFoAPiqL49KSLpivpvPMqdOYkI94Vxct35ziHU5FZhfGc3ZmYlZ7q4sgvNwATVYG0 qyng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=H6U86CkM; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="eRSlr/hv"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=c2f621bo; dkim=neutral (body hash did not verify) header.i=@unstable.cc header.s=20220809-q8oc header.b=XalFFFR3; 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 e9e14a558f8ab-3d96a650aeasi9552735ab.165.2025.04.30.05.51.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Apr 2025 05:51:35 -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=H6U86CkM; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="eRSlr/hv"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=c2f621bo; dkim=neutral (body hash did not verify) header.i=@unstable.cc header.s=20220809-q8oc header.b=XalFFFR3; 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:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:Date:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=V90tuVMbfQeDw8EJ73n6qy/VTB95qodZIzMBKMoH7dI=; b=H6U86CkMuO58GvZUwn1p4Xf7HD DcAiwpYSLmy2yeDo6y24HIslIVoJ2Lf54qBVGaovXwQ/9kEroOSg5P4rtcUttP1CBdlxAHb6guBJB /XOXCSf/yxGcczW5vRQ44wgE9WterCVRaK92w/zrskEolLMBEEnVd1Hvqg5bA+V++io0=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1uA6uP-0002fH-6F; Wed, 30 Apr 2025 12:51:29 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uA6uA-0002ex-Tn for openvpn-devel@lists.sourceforge.net; Wed, 30 Apr 2025 12:51:14 +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=vHDHoFUEFLqB+9/Qy5Ex3wRayJB1sMflKxzsQziLgh0=; b=eRSlr/hvn8nLywcJKMPTOqHLGB osLpv/W38gfkPteIHnUsP8qkhZKhYe9J1fu+TJ8x5b14D4UVvgRxhfq1apzzh+nSyhtGOykenyui7 F3rRvlgs4XJt0HXTnwgM00cOTTpvwtiB3JjA0ijuFyviOz5wNa5v0vrcUVWW2JMgZwgY=; 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=vHDHoFUEFLqB+9/Qy5Ex3wRayJB1sMflKxzsQziLgh0=; b=c 2f621bomoKPAE2vrWraxZMucsJbIqXuhiIhR5t2wlGfzzuubJp9iC40Xq4dq/heg7CUASPXyrGPzz aqUyGG3VVgCKjSCz0rylotKItsDkinTDteaiI3lls7tEXjxLWtsRHFvlWQFIg/gvjfmjAQ12VsRkL 1Nhpg1ME9v71+6JE=; Received: from wilbur.contactoffice.com ([212.3.242.68]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1uA6to-0006zR-BF for openvpn-devel@lists.sourceforge.net; Wed, 30 Apr 2025 12:51:08 +0000 Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by wilbur.contactoffice.com (Postfix) with ESMTP id 2E7BE1A03; Wed, 30 Apr 2025 14:33:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1746016427; s=20220809-q8oc; d=unstable.cc; i=a@unstable.cc; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Transfer-Encoding; bh=vHDHoFUEFLqB+9/Qy5Ex3wRayJB1sMflKxzsQziLgh0=; b=XalFFFR3dMO7UJ9zimiHJbt6lBptIqrQLwZSZaderJqtRP5YlOWZipSrTpXUAmkL +DpLH/xvnC1JxFaeiI3AhrL/H8y6hJIJ09e+PUBEq5qi+Y4MCjQSWEXjdqz/fdsiTbi Xf8djFOB4IMwWHYu1lh+iTSfo1bfp46qnS1owc0CA8KS7GeNdcOKCZ5ZS1QPzst648w QzvgP3kjkYw7CN7/jBa/oxQDOvZZRsB+kahiBWUSZyH9JpzRz23L5ZFth288F9BosL+ Q+RxPr59d975dJe3Vg2hOST96i3rnVWoEtmakVy4/1dSQrGcKf/lWevCwRKY8wfZel7 s36RBYZVZw== Received: by smtp.mailfence.com with ESMTPSA ; Wed, 30 Apr 2025 14:33:44 +0200 (CEST) From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Wed, 30 Apr 2025 14:32:49 +0200 Message-ID: <20250430123250.8627-1-a@unstable.cc> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-ContactOffice-Account: com:375058688 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", 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: From: Antonio Quartulli In case of UDP peer timeout, an openvpn client (userspace) performs the following actions: 1. receives the peer deletion notification (reason=timeout) 2. closes the socket 3. deletes the ovpn interfac [...] Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [212.3.242.68 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [212.3.242.68 listed in sa-accredit.habeas.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-Headers-End: 1uA6to-0006zR-BF Subject: [Openvpn-devel] [PATCH ovpn-net-next 1/2] ovpn: don't access sk after release X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli , sd@queasysnail.net Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1830832041705772458?= X-GMAIL-MSGID: =?utf-8?q?1830832041705772458?= From: Antonio Quartulli In case of UDP peer timeout, an openvpn client (userspace) performs the following actions: 1. receives the peer deletion notification (reason=timeout) 2. closes the socket 3. deletes the ovpn interface Upon 3. we have the following: - dellink() - cancel_delayed_work_sync() - ovpn_peer_keepalive_work() - ovpn_socket_release() - synchronize_rcu() At this point, due to 2., ovpn_sock->sock->sk becomes NULL and ovpn_socket_release() will attempt dereferencing it, resulting in the following crash log: Oops: general protection fault, probably for non-canonical address 0xdffffc0000000077: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x00000000000003b8-0x00000000000003bf] CPU: 12 UID: 0 PID: 162 Comm: kworker/12:1 Tainted: G O 6.15.0-rc2-00635-g521139ac3840 #272 PREEMPT(full) Tainted: [O]=OOT_MODULE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-20240910_120124-localhost 04/01/2014 Workqueue: events ovpn_peer_keepalive_work [ovpn] RIP: 0010:ovpn_socket_release+0x23c/0x500 [ovpn] Code: ea 03 80 3c 02 00 0f 85 71 02 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 64 24 18 49 8d bc 24 be 03 00 00 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2 0f 85 30 RSP: 0018:ffffc90000c9fb18 EFLAGS: 00010217 RAX: dffffc0000000000 RBX: ffff8881148d7940 RCX: ffffffff817787bb RDX: 0000000000000077 RSI: 0000000000000008 RDI: 00000000000003be RBP: ffffc90000c9fb30 R08: 0000000000000000 R09: fffffbfff0d3e840 R10: ffffffff869f4207 R11: 0000000000000000 R12: 0000000000000000 R13: ffff888115eb9300 R14: ffffc90000c9fbc8 R15: 000000000000000c FS: 0000000000000000(0000) GS:ffff8882b0151000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f37266b6114 CR3: 00000000054a8000 CR4: 0000000000750ef0 PKRU: 55555554 Call Trace: unlock_ovpn+0x8b/0xe0 [ovpn] ovpn_peer_keepalive_work+0xe3/0x540 [ovpn] ? ovpn_peers_free+0x780/0x780 [ovpn] ? lock_acquire+0x56/0x70 ? process_one_work+0x888/0x1740 process_one_work+0x933/0x1740 ? pwq_dec_nr_in_flight+0x10b0/0x10b0 ? move_linked_works+0x12d/0x2c0 ? assign_work+0x163/0x270 worker_thread+0x4d6/0xd90 ? preempt_count_sub+0x4c/0x70 ? process_one_work+0x1740/0x1740 kthread+0x36c/0x710 ? trace_preempt_on+0x8c/0x1e0 ? kthread_is_per_cpu+0xc0/0xc0 ? preempt_count_sub+0x4c/0x70 ? _raw_spin_unlock_irq+0x36/0x60 ? calculate_sigpending+0x7b/0xa0 ? kthread_is_per_cpu+0xc0/0xc0 ret_from_fork+0x3a/0x80 ? kthread_is_per_cpu+0xc0/0xc0 ret_from_fork_asm+0x11/0x20 Modules linked in: ovpn(O) Reason for accessing sk is because we need to retrieve its protocol and continue the cleanup routine accordingly. Fix the crash by storing the sk_protocol before releasing the sk and invoking synchronize_rcu(). Signed-off-by: Antonio Quartulli --- drivers/net/ovpn/socket.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ovpn/socket.c b/drivers/net/ovpn/socket.c index a83cbab72591..ff499f0fc771 100644 --- a/drivers/net/ovpn/socket.c +++ b/drivers/net/ovpn/socket.c @@ -66,6 +66,7 @@ static bool ovpn_socket_put(struct ovpn_peer *peer, struct ovpn_socket *sock) void ovpn_socket_release(struct ovpn_peer *peer) { struct ovpn_socket *sock; + u16 sk_protocol; bool released; might_sleep(); @@ -92,6 +93,7 @@ void ovpn_socket_release(struct ovpn_peer *peer) */ lock_sock(sock->sock->sk); released = ovpn_socket_put(peer, sock); + sk_protocol = sock->sock->sk->sk_protocol; release_sock(sock->sock->sk); /* align all readers with sk_user_data being NULL */ @@ -99,9 +101,9 @@ void ovpn_socket_release(struct ovpn_peer *peer) /* following cleanup should happen with lock released */ if (released) { - if (sock->sock->sk->sk_protocol == IPPROTO_UDP) { + if (sk_protocol == IPPROTO_UDP) { netdev_put(sock->ovpn->dev, &sock->dev_tracker); - } else if (sock->sock->sk->sk_protocol == IPPROTO_TCP) { + } else if (sk_protocol == IPPROTO_TCP) { /* wait for TCP jobs to terminate */ ovpn_tcp_socket_wait_finish(sock); ovpn_peer_put(sock->peer); From patchwork Wed Apr 30 12:32:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 4231 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:31a6:b0:656:592e:a137 with SMTP id u6csp868706mac; Wed, 30 Apr 2025 05:51:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVF71A0VZYPrEctsjBPJdoeD5hjYNTFD83IEAaouOWm+L1RSMMKwppYxBo2wdMv2h+2wPv+PMvjUgs=@openvpn.net X-Google-Smtp-Source: AGHT+IFs35bUmg5dFy304ygMveTou/usmN0paF04Uila35DN0wujxWAjzK+xUYVkJj8i8Q6buT0x X-Received: by 2002:a05:6602:728b:b0:864:48ec:c312 with SMTP id ca18e2360f4ac-86497f6384amr221553339f.3.1746017494986; Wed, 30 Apr 2025 05:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746017494; cv=none; d=google.com; s=arc-20240605; b=Ru6EkYE0sVSVksBdzVGu04v67xWL8QGPWSqU/7Vka+n4BGqVofjfmDgkLtIhVHITz1 obmJEA1+ht5f1QgPacBcT8ZQKEFoIX1sHVX69OoJi2Cv4jDHizPyYCUAsGUXeKanRKGF kdZsfin3Km9dP0pU/IIrG9pbJP7lyqW58VlqauVBBzFz/YvexbAz1rQQnrjyy0S+RGBo n3WAm7nLLvWAOJ35KOYH0tiUn+gzp2hx2kt9T++6WBT9tfPDQRtEACwYUBd0SQwYxtlH 8kQIolbM2dNUgZue5HGv2Q4oyZU+OZJ6RdHREvLyQrmhs2y6IDeqIcFy0/AWwOV720R6 TMBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:cc: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=rHcbBOfOoKSRgKE2SYQCO8Ir11z41iivRlUNd6Xa4oM=; fh=BEXsVF2vhWxaMgs2qFKAWZUkW8vXXdGeO1y9DIa+eNM=; b=jF2zgrZyqcVjOhyCIk2T87/UDW5VAvMqK6ytdyN9caYuWui/OyuaDFd4Y2Rd32DIgP BO5XvodlrunYfKm4OU445YLw29W+FywrNbhJYkvUW1C9ctyCbAu7JLU2FrEv1kG/O93P unlYn2qu3cngxlfQo1yhiksk2/MDG5WxdVE5O2ctOKjFKGtGaf8rLAkCNwwllenfTGzl t41w3ECCh+kzRvHa7BGrRE3tIR2i+g5o/Sx88I5OhZ6Wsqo2oukcVYf8EuKrZiHh4xFA mpxfRJjv54xEmAWyL9InLE/hPW+5iqf9U2a/OhPldG14owAfN8zlKLID0X52PHyjOhUj pN+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=cafyVKRO; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=GqCGSIWN; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VCaciNVk; dkim=neutral (body hash did not verify) header.i=@unstable.cc header.s=20220809-q8oc header.b=iyvjKpCo; 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 8926c6da1cb9f-4f8630fb356si4574961173.150.2025.04.30.05.51.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Apr 2025 05:51:34 -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=cafyVKRO; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=GqCGSIWN; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VCaciNVk; dkim=neutral (body hash did not verify) header.i=@unstable.cc header.s=20220809-q8oc header.b=iyvjKpCo; 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:Cc: 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:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rHcbBOfOoKSRgKE2SYQCO8Ir11z41iivRlUNd6Xa4oM=; b=cafyVKROR99Kwef8p0/cbQ2CAH A1w1zVsdLm5Iuku/6cDlCTXmsv9phrH1PgHTWLGU5RoQj3FGVs0q/yPwmS5khG3a/+oA9KR4TVRNO AhormKu3kHhBAfXc47MXNAJqrIjLj6hHIs8pgAlZUaI0przh7ASGxY3db+1w3zeAig1A=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1uA6uK-0007sC-Gr; Wed, 30 Apr 2025 12:51:24 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uA6u2-0007rs-R7 for openvpn-devel@lists.sourceforge.net; Wed, 30 Apr 2025 12:51:07 +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: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tHhbc2DKkupEj/eFXC48+4PIOx3elaVvHrKklqKcL4Y=; b=GqCGSIWNbXTWSuXN5HM+WZ21WV wKqJiz3XFaMVfkBUNjMnItEYOkLvbRd4dtvsKwYmheeiazgCF0lSYFo3u1M3DTTGDqykczareejKj EWmOHJvpiNnLfYMv1am0I5Nxbdp8Nv0BlKpTUQtlbqOzoDEpDEf3fEefkIpabxOwSI0I=; 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: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tHhbc2DKkupEj/eFXC48+4PIOx3elaVvHrKklqKcL4Y=; b=VCaciNVkCDbPyB/Oha2+Ijdp8D Zss0+J1FGwsorVj0R+IfWskTH1tqZVe9pLA5Rph7DMpLMVDzWaK4Ho0xgD4Idhyu2HXzoI8Uuq6a9 xXrkCTqLZd22MCzj4ww5ZjKTuQxdte/S8N96imMaqkDoLQnDgYJzZGPsYALN/H1iRvlA=; Received: from wilbur.contactoffice.com ([212.3.242.68]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1uA6tj-0006z8-BC for openvpn-devel@lists.sourceforge.net; Wed, 30 Apr 2025 12:51:06 +0000 Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by wilbur.contactoffice.com (Postfix) with ESMTP id E3F111A44; Wed, 30 Apr 2025 14:33:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1746016428; s=20220809-q8oc; d=unstable.cc; i=a@unstable.cc; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=tHhbc2DKkupEj/eFXC48+4PIOx3elaVvHrKklqKcL4Y=; b=iyvjKpCo9Z5qyaz2WeURHTpkX9KHgUsnh/FyShvy6B8N37fizHSEYxywnJf+KxrY 5FVE6EFw2QwC2RmCh99VG+ZrWvKtAWR6xPddfA1x3n4/sZLFYdPO+gx1QsGqV9/c8xF cjxzx11yU5GNBMgAGhB/2zOQSLjpBlkbQB7QXBy0K6SP1w5HtHYCjpqYY5M13AsBeyk QacU3CEDwa12KCRibRYO/4FhLET2keRFr2dUlQe/9rAl03YdToG2zoBCM7tbUlREYWu /I0ctJiiCcNjEmNcU4BGRwlLL8uUcMSUrjIBe3hGKxdb/iz2g8jbwCVL/8wZe43b2rH +uv3K9SK2w== Received: by smtp.mailfence.com with ESMTPSA ; Wed, 30 Apr 2025 14:33:45 +0200 (CEST) From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Wed, 30 Apr 2025 14:32:50 +0200 Message-ID: <20250430123250.8627-2-a@unstable.cc> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250430123250.8627-1-a@unstable.cc> References: <20250430123250.8627-1-a@unstable.cc> MIME-Version: 1.0 X-ContactOffice-Account: com:375058688 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", 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: From: Antonio Quartulli The keepalive worker is cancelled before calling unregister_netdevice_queue(), therefore it will never hit a situation where the reg_state can be different than NETDEV_REGISTERED. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [212.3.242.68 listed in sa-accredit.habeas.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [212.3.242.68 listed in bl.score.senderscore.com] X-Headers-End: 1uA6tj-0006z8-BC Subject: [Openvpn-devel] [PATCH ovpn-net-next 2/2] ovpn: drop useless reg_state check in keepalive worker X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli , sd@queasysnail.net Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1830832040534334687?= X-GMAIL-MSGID: =?utf-8?q?1830832040534334687?= From: Antonio Quartulli The keepalive worker is cancelled before calling unregister_netdevice_queue(), therefore it will never hit a situation where the reg_state can be different than NETDEV_REGISTERED. For this reason, checking reg_state is useless and the condition can be removed. Signed-off-by: Antonio Quartulli --- drivers/net/ovpn/peer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c index a37f89fffb02..24eb9d81429e 100644 --- a/drivers/net/ovpn/peer.c +++ b/drivers/net/ovpn/peer.c @@ -1353,8 +1353,7 @@ void ovpn_peer_keepalive_work(struct work_struct *work) } /* prevent rearming if the interface is being destroyed */ - if (next_run > 0 && - READ_ONCE(ovpn->dev->reg_state) == NETREG_REGISTERED) { + if (next_run > 0) { netdev_dbg(ovpn->dev, "scheduling keepalive work: now=%llu next_run=%llu delta=%llu\n", next_run, now, next_run - now);