| Message ID | 20230214135658.1034787-1-arne@rfc2549.org |
|---|---|
| State | Changes Requested |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp4093270dyk;
Tue, 14 Feb 2023 05:57:56 -0800 (PST)
X-Google-Smtp-Source:
AK7set8uqYyN4hs/qEmWYT/g8OKJCX4+XNNb4z2HE6iZMAybLPYqU3+ZMxtqW2/KzxRCWqqUp6if
X-Received: by 2002:a9d:6504:0:b0:68d:4bd4:8abf with SMTP id
i4-20020a9d6504000000b0068d4bd48abfmr729228otl.6.1676383076734;
Tue, 14 Feb 2023 05:57:56 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1676383076; cv=none;
d=google.com; s=arc-20160816;
b=ksCx8T22L6alc05Z2CtSsH148lCKL87Q6ONjUCQFwPcC/or+847QZOeuaIGOxovl7l
EgLghPBKdYibiumMRT5DXSx2NgZcnOL5B8mn4pZmVYjAogK8uGwRGhp6KfOT/54WWT5i
PiL9wyc2wwkPHkuz/d9Q57/Io5PNuU88ZKj0Qenvfde1cmYCCba1TnqnCXaiugw5WnzW
VIhZFtix2jaDXCPGoWLf2lMSIxPLh5szmfLl1dR6huvZKw0QrhcgrCfZ+yt8A/nrtzUl
nhUjmqYrY23Ojk0hjoH2q/3228ojql+bonaPFNjD0SHfJVTgYrC47X33xackMuASV/Fk
61FA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
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;
bh=AQQ02uwbj1g3hNYqeq8fTKeigcrJNvOLytnHo9o3Pxw=;
b=OeAdiptxzx2QiJdaQYWmDC1P3QVl3WFUZlTtuQPa+hJeT/y+bjgpnBCL58JkPpMiPu
tsfOw67NH/1OnSgPmCGc4Tb4OxUNE/hTjWPOyThWV4SRm0esT07NKph353mtjspMOWu0
dYtL9lLPKAVleXZnOfYzji+E/NjZinusICzkVcmRUy40oC6LUHOj5rgEvQXn1QvZOpFg
ozahfyM6PhlGBEvat+MId83s4nrO/dw1RwjS3xjtYzeIp1K9B+ZyP014YLrkpCx3QS6e
fp8OpojakHmMTgbGD2H2ipI6ARD5U0xBcU3RDwscgd9IdcV7b0urVEbzWImibgrgJrWU
if9A==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=Xq41JGhb;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=inKK6nhQ;
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
l26-20020a056830155a00b00684c064b008si16292641otp.3.2023.02.14.05.57.56
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 14 Feb 2023 05:57:56 -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=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=Xq41JGhb;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=inKK6nhQ;
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 [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com)
by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1pRvo0-00076f-RL;
Tue, 14 Feb 2023 13:57:12 +0000
Received: from [172.30.20.202] (helo=mx.sourceforge.net)
by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95)
(envelope-from <arne@kamera.blinkt.de>) id 1pRvnz-00076V-Mq
for openvpn-devel@lists.sourceforge.net;
Tue, 14 Feb 2023 13:57:10 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
List-Subscribe:List-Post:List-Owner:List-Archive;
bh=YtKqneswolY7mDEnBg3kl7JgPmtpskUsgYyza1Stke0=; b=Xq41JGhb0XbipdfwP18Fmx7Z97
5kXKX/f2RC/XHqIVqSoKA4QioRLsnA1kHrPQQMDKRLUxVi4hLiq1uHP3eT8U/AmFXiMjYMHGPVkmw
7zZkV1AJuU6YPLKkK4XjEuBUE0Z6DOtZ9Yc0Imi4Q9cNyWBs5tn1/AdaE3RNo7fne21E=;
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: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:In-Reply-To:
References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:
List-Owner:List-Archive; bh=YtKqneswolY7mDEnBg3kl7JgPmtpskUsgYyza1Stke0=; b=i
nKK6nhQ+E80422b3KIX0qg/l7BcZNVyf+CAylJ+2Qudab6oEyFsNIZfaGeJXEhkFZB+jxd5+XAX3a
WZTuGFBHWurREeHy7Z9uC1oRso49zmOJaujwHIdY5UXDPfGcoEAAaPT7erhmiQ+6x0MV+F5N7aAqX
OI3/wocb8nBpYmpg=;
Received: from mail.blinkt.de ([192.26.174.232])
by sfi-mx-1.v28.lw.sourceforge.com with esmtps
(TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95)
id 1pRvnt-004ERH-PL for openvpn-devel@lists.sourceforge.net;
Tue, 14 Feb 2023 13:57:10 +0000
Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c])
by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD))
(envelope-from <arne@kamera.blinkt.de>) id 1pRvnm-0000qI-Fk
for openvpn-devel@lists.sourceforge.net;
Tue, 14 Feb 2023 14:56:58 +0100
Received: (nullmailer pid 1034833 invoked by uid 10006);
Tue, 14 Feb 2023 13:56:58 -0000
From: Arne Schwabe <arne@rfc2549.org>
To: openvpn-devel@lists.sourceforge.net
Date: Tue, 14 Feb 2023 14:56:58 +0100
Message-Id: <20230214135658.1034787-1-arne@rfc2549.org>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
X-Spam-Score: 0.3 (/)
X-Spam-Report: Spam detection software,
running on the system "util-spamd-1.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: This can happen if the memory alloc fails. Signed-off-by:
Arne Schwabe <arne@rfc2549.org> --- src/openvpn/dco_linux.c | 8 ++++++-- 1
file changed, 6 insertions(+),
2 deletions(-) diff --git a/src/openvpn/dco_linux.c
b/src/openvpn/dco_linux.c index c84f9cfe1..b1103c8d5 100644 ---
a/src/openvpn/dco_linux.c
+++ b/src/openvpn/dco_linux.c @@ -79,10 +79,14 @@ typedef int (*ovpn_nl_c
[...] Content analysis details: (0.3 points, 6.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
mail domains are different
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
0.0 SPF_NONE SPF: sender does not publish an SPF Record
X-Headers-End: 1pRvnt-004ERH-PL
Subject: [Openvpn-devel] [PATCH] Add missing check for nl_socket_alloc
failure
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: =?utf-8?q?1757815061060043541?=
X-GMAIL-MSGID: =?utf-8?q?1757815061060043541?=
|
| Series |
[Openvpn-devel] Add missing check for nl_socket_alloc failure
|
|
Commit Message
Arne Schwabe
Feb. 14, 2023, 1:56 p.m. UTC
This can happen if the memory alloc fails.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
src/openvpn/dco_linux.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
Hi, On Tue, Feb 14, 2023 at 02:56:58PM +0100, Arne Schwabe wrote: > resolve_ovpn_netlink_id(int msglevel) > { > - int ret; > struct nl_sock *nl_sock = nl_socket_alloc(); > > - ret = genl_connect(nl_sock); > + if (!nl_sock) > + { > + msg(msglevel, "Allocating net link socket failed"); > + } ... shouldn't we abort in this case, aka, M_FATAL (or "return -errno")? gert
Am 14.02.23 um 15:01 schrieb Gert Doering: > Hi, > > On Tue, Feb 14, 2023 at 02:56:58PM +0100, Arne Schwabe wrote: >> resolve_ovpn_netlink_id(int msglevel) >> { >> - int ret; >> struct nl_sock *nl_sock = nl_socket_alloc(); >> >> - ret = genl_connect(nl_sock); >> + if (!nl_sock) >> + { >> + msg(msglevel, "Allocating net link socket failed"); >> + } > > ... shouldn't we abort in this case, aka, M_FATAL (or "return -errno")? I don't think so. This function is called from two code paths: - dco_available: I don't think if detection of dco fails, we should quit openvpn completely. - ovpn_dco_init_netlink: Here we already call it with M_ERR, which is (M_FATAL | M_ERRNO) Arne
diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index c84f9cfe1..b1103c8d5 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -79,10 +79,14 @@ typedef int (*ovpn_nl_cb)(struct nl_msg *msg, void *arg); static int resolve_ovpn_netlink_id(int msglevel) { - int ret; struct nl_sock *nl_sock = nl_socket_alloc(); - ret = genl_connect(nl_sock); + if (!nl_sock) + { + msg(msglevel, "Allocating net link socket failed"); + } + + int ret = genl_connect(nl_sock); if (ret) { msg(msglevel, "Cannot connect to generic netlink: %s",