From patchwork Mon Nov 16 10:25:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5710 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:9292:b0:11a:f58a:e788 with SMTP id dc18csp1006691lab; Mon, 16 Nov 2026 02:25:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEa2u0YWV9qdaRW4KdUwcHlo3O9T/Xs+6kbuLjM4Vsgemau0u3CFWNhn91gniIOdsTRdQhIF5TI+i8=@openvpn.net X-Received: by 2002:a05:7022:ea47:20b0:17a:a3d4:8b17 with SMTP id a92af1059eb24-1b5030990d0mr9704573c88.12.1794824728929; Mon, 16 Nov 2026 02:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794824728; cv=none; d=google.com; s=arc-20260327; b=MAkEC9NcW27LMlMqjbFac3nlYzXRTns5n82dE3igpmIt46OurhHM99Dd3GrhiRF/QV +eEEPulRFurpaDOTTwRaHbZkh2AYx7lHmoKZgXXe6ALmwf9siZ7rkkHfKXP2UglLywSV Rlr1Lz7JN2Fcr+gqWYD3mtkeeUlUmdmTVbAz2UsBoxoJ1dnnk38ib62OTePooPuGPjBF ckfXz4y8dlLOUpU3We0M8fuH7rcDkcBx8QMbQExIj6b4oa8fe/8cPnsr5ETnldnznBrG eBtrUB1GrYr0JpuRsLpY8f8F3WybRvCj7HfE3WBlqxVs/4CibOyFVTjcHlCE8kFUcHOd Nzvg== 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; bh=tTG+Sf4O7EzrEhTp4O9HKjugK9OwXlSH8mmZLfJ60pE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=iwmC//CiGi7QOFYqn78LB1R5KN8XV6XztTbb8sytxT+labe/7sdFs2746PzrnSbQAp KCWnVYSa+2nZrL0eBOgmoq7wm6+CUyisw6jZJhdDK6pRdLmghhtlunTmDAjwl4Hdgnxt QiBPtLDAJViqvap2uuCalOqjrKLuvP07pDTNLzvqReF9AawKtgZA3q/rrgIxgnWQ2kKN NzKZZV8H+JajijMf7HK07x3C9f2awxSKoYn1QB7k3P2WRSRXnCHBQKHUAMeIgM4wCv5H 0Blb1imXGodLv1QEo0xJ9z8xCroB0VU73bPRkXd7ZuQuWlqUhr5RQVJOH0iNplUDMm/1 6AxQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="f3i/TfF5"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=i2TqNNlQ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=MKQSgWXK; 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=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id a92af1059eb24-1b503180453si33558297c88.6.2026.11.16.02.25.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2026 02:25:28 -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="f3i/TfF5"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=i2TqNNlQ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=MKQSgWXK; 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=muc.de 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=tTG+Sf4O7EzrEhTp4O9HKjugK9OwXlSH8mmZLfJ60pE=; b=f3i/TfF5wEU8q9 7CNZBYhMn58JW6PD+z8UrQs/Lhy3hE1zWNltmbKHeiKr+2BkGaRaTGmoI0a4NvxVNRWSauw6chvvY bcgOm2xXnv5h21SSHuG78K906KrVJkdIRq3kHtL934e9bVQLWtg+62t4o6RV8tI5SI1n4MPxGCCeG zOA=; 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 ) id 1xSttv-000000002tZ-1Boq; Mon, 16 Nov 2026 10:25:27 +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 ) id 1xSttu-000000002tN-0bdL for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 10:25:26 +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=y11KRqbJgnDICHM223FH/VLvqwEbPVu2uUwZA2Hsb/A=; b=i2TqNNlQWmx9z0LM+4/SddykVn eVVJ7BzwpkHcV1haLAlhdsbHUSB7xr8Lxnn9V/XNhPJdwYVDOyiBdxAwUX8UpNADMH9PWAea7D6au NzhZ2qosoMCC67gXXqLvVVMhuPF6A9XRuDB8Wzn9egYP5+WNjbwJMgkDreFCe+u0UA7I=; 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=y11KRqbJgnDICHM223FH/VLvqwEbPVu2uUwZA2Hsb/A=; b=MKQSgWXK1fk86tX/40USmZCw+I HiDdN8wLFo/zoqf7qu0c8ijVrv5h2vCGlnQl6F/ButKRjTGgEC4McLnkgIly3Lqd8pPRghRToE0i5 yS/Xzyj15SAjzvQVTnl+1xUaIzn4a8iWK0WbXcgU7V3opQFhn8oeQq8QePRVQ//XzcjA=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xStts-00000000376-1FOP for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 10:25:26 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 6AGAPH8c014507 for ; Mon, 16 Nov 2026 11:25:17 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AGAPHMR014506 for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 11:25:17 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 16 Nov 2026 11:25:11 +0100 Message-ID: <20261116102516.14493-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) 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: From: Razvan Cojocaru dco_new_peer() and dco_get_peer() passed the result straight to nla_nest_start() without checking for NULL. Return -ENOMEM like the other callers. dco_new_peer() unchecked since e34437c2 ("dco: introduce low-level code for handling ovpn-dco in the Linux kernel"), dco_get_peer() since 5a8fb55a ("dco-linux: implement dco_get_peer_stats{, multi} AP [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xStts-00000000376-1FOP Subject: [Openvpn-devel] [PATCH v1] dco_linux: check ovpn_dco_nlmsg_create() result in new/get peer 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: 1882010134929834682 X-GMAIL-MSGID: 1882010134929834682 From: Razvan Cojocaru dco_new_peer() and dco_get_peer() passed the result straight to nla_nest_start() without checking for NULL. Return -ENOMEM like the other callers. dco_new_peer() unchecked since e34437c2 ("dco: introduce low-level code for handling ovpn-dco in the Linux kernel"), dco_get_peer() since 5a8fb55a ("dco-linux: implement dco_get_peer_stats{, multi} API"). Change-Id: Idb3c52174e588016240e9c9162a1676e1531c551 Signed-off-by: Razvan Cojocaru Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2101 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2101 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 4412ad0..50d4c54 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -234,6 +234,12 @@ msg(D_DCO_DEBUG, "%s: peer-id %u, fd %d, remote addr: %s", __func__, peerid, sd, remotestr); struct nl_msg *nl_msg = ovpn_dco_nlmsg_create(dco, OVPN_CMD_PEER_NEW); + if (!nl_msg) + { + gc_free(&gc); + return -ENOMEM; + } + struct nlattr *attr = nla_nest_start(nl_msg, OVPN_A_PEER); int ret = -EMSGSIZE; @@ -1229,6 +1235,11 @@ msg(D_DCO_DEBUG | M_NOIPREFIX, "%s: peer-id %d", __func__, peer_id); struct nl_msg *nl_msg = ovpn_dco_nlmsg_create(dco, OVPN_CMD_PEER_GET); + if (!nl_msg) + { + return -ENOMEM; + } + struct nlattr *attr = nla_nest_start(nl_msg, OVPN_A_PEER); int ret = -EMSGSIZE;