From patchwork Tue Nov 21 17:06:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3472 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:53c1:b0:f2:62eb:61c1 with SMTP id u1csp542949dye; Tue, 21 Nov 2023 09:34:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuFqURBw0zPwq3AmiPHQ0VsvmyfpLJYlOZAGOj0IEexcmdmB330lbBlWK8XYs1MoJu8QRD X-Received: by 2002:a17:90b:a4d:b0:281:2d56:e751 with SMTP id gw13-20020a17090b0a4d00b002812d56e751mr11700783pjb.0.1700588043125; Tue, 21 Nov 2023 09:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588043; cv=none; d=google.com; s=arc-20160816; b=kgTwv79zM+FLofYK43Yr+l9q+Y9biii+hrYyvIu+A+Y2R6ac7anIAlXrHZDsOyFbNk 2yZih7KG44mylAOizC/5GYHZxeqE6BFufvE+0T+UMKm3qgdH74CwL612N40cPBJT2m8W snD1ddN0XQgeA8hAfijMMZNHQMQErJ89XnKOiMJwDLfTo823hcwGNM+7/hrL03Pat7Y8 pbhUo3fSnPAreL8rL6UxZIFSxvH3oZLct9b2yogh0APD+hwPe3mwfEsHikGuq8XjqWnh V+m9nXdRR98AnbUXfjEPka2jWTm/Ir3AIVy18eUR5VDA1BFQ/oSDyeNByOC/i259Wjes yHXg== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=wJBU6qkPUNQBBRbI7O9NoOjd/MONmtyntR7L61kIswE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=x83PcGORbhF7m7ZYEI1iP5LPqy3/0DJqZ97ibMY6JER0pwzkFIMyDTVZCsQLq4Ff97 9Nkv5olMDTDmf9dF35LUVQ5vayDfCq5+VjrBm2QibF9z9/V3cHKLyZycOaPE0RtragLu 3KtasTHzlQR2i3SY/xMH1gjIMDu356GBTPux0V8SC7zxR6b3SDWVQb6Bf5b9WhfN36He ACl/EvMmHGEgbY5f4hNHy/kTH7yroTZSY8P2rVRQRiDPdVstN7IHoB1JFjuDMFbPc/qp hgMCN5N2MOShaCBA9TIXKR3FP3y/0pFAeQe5Rf8ViO+RxD7nf7z1jxSsAxy10Uv6V/uA T13g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=XwTZaJ9j; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=j6tdpyjr; 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 in7-20020a17090b438700b002839de4d6a0si9256965pjb.69.2023.11.21.09.34.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Nov 2023 09:34:03 -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=XwTZaJ9j; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=j6tdpyjr; 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-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1r5Ucm-0005am-0E; Tue, 21 Nov 2023 17:33:22 +0000 Received: from [172.30.20.202] (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 ) id 1r5Uck-0005aW-13 for openvpn-devel@lists.sourceforge.net; Tue, 21 Nov 2023 17:33:20 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=WsALM4NyFeqqweq++za+qPaSh6CuRzDaIHl7oUOO2EE=; b=XwTZaJ9jAEVO3qzkvLhzs4BCPV p2IEVf6qY13ao6BcqUKeT35egKuw6EAQg6DaEqCJY9E0hm9xyjFfJxLhyOrRwPkR1wOghC3MGxiOZ IOX96qhKUuoKoi8ydyhnGLagDY+Sl1hWinFUQ2MDsMRRyX4k2xogOAPpbXxJq1HTb8hQ=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=WsALM4NyFeqqweq++za+qPaSh6CuRzDaIHl7oUOO2EE=; b=j6tdpyjrso8K9wduOm+Tnui8Q/ e1rkWZWXRbjWQG5+kRi5gCjrlArcTcKO6TtXRmwPk45IC2f4jDjYuTZIGQhDfcvPpUHi/QhwIFB2l uNWmhUlm+BFRF7P6OsW8HtNbuc62iBOMgdb4ASVUtAYkrPPYysm8x0F48DjY6RyzI34M=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1r5Ucb-0004hC-EK for openvpn-devel@lists.sourceforge.net; Tue, 21 Nov 2023 17:33:18 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.96.1 (FreeBSD)) (envelope-from ) id 1r5UCJ-000ME6-0R for openvpn-devel@lists.sourceforge.net; Tue, 21 Nov 2023 18:06:03 +0100 Received: (nullmailer pid 886849 invoked by uid 10006); Tue, 21 Nov 2023 17:06:03 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Tue, 21 Nov 2023 18:06:03 +0100 Message-Id: <20231121170603.886801-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230214135658.1034787-1-arne@rfc2549.org> References: <20230214135658.1034787-1-arne@rfc2549.org> MIME-Version: 1.0 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: This can happen if the memory alloc fails. Patch V2: add goto error Patch V3: return -ENOMEM instead of going to error Change-Id: Iee66caa794d267ac5f8bee584633352893047171 Signed-off-by: Arne Schwabe --- src/openvpn/dco_linux.c | 6 ++++++ 1 file changed, 6 insertions(+) Content analysis details: (0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1r5Ucb-0004hC-EK Subject: [Openvpn-devel] [PATCH v3] 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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?1783195807904580604?= This can happen if the memory alloc fails. Patch V2: add goto error Patch V3: return -ENOMEM instead of going to error Change-Id: Iee66caa794d267ac5f8bee584633352893047171 Signed-off-by: Arne Schwabe Acked-by: Antonio Quartulli --- src/openvpn/dco_linux.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index b033f8543..3c91606b7 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -81,6 +81,12 @@ resolve_ovpn_netlink_id(int msglevel) int ret; struct nl_sock *nl_sock = nl_socket_alloc(); + if (!nl_sock) + { + msg(msglevel, "Allocating net link socket failed"); + return -ENOMEM; + } + ret = genl_connect(nl_sock); if (ret) {