Article View: linux.kernel.netdev
Article #6814Re: [PATCH net 7/7] selftests: ovpn: avoid calling freeaddrinfo() on NULL
From: netdev-bot+sashiko
Date: Fri, 23 Oct 2026 12:17
Date: Fri, 23 Oct 2026 12:17
74 lines
10402 bytes
10402 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The Fixes: tag in commit "selftests: ovpn: avoid calling
freeaddrinfo() on NULL" names the wrong commit.
--
selftests: ovpn: avoid calling freeaddrinfo() on NULL
This patch changes the exit path of ovpn_parse_remote() in
tools/testing/selftests/net/ovpn/ovpn-cli.c so that freeaddrinfo() is
called only when result is non-NULL. On musl, passing NULL to
freeaddrinfo() makes ovpn-cli segfault.
> ovpn_parse_remote() always calls freeaddrinfo() on its exit path, but
> result is NULL when no vpnip was passed (with or without a remote host).
[ ... ]
> Fixes: 959bc330a439 ("testing/selftests: add test tool and scripts for ovpn module")
> Cc: stable@vger.kernel.org
[Severity: Low]
Does this Fixes: tag point at the right commit?
In 959bc330a439, result had no initializer, and the host branch in
ovpn_parse_remote() did not free or reset it:
struct addrinfo *result;
...
memcpy(&ovpn->remote, result->ai_addr, result->ai_addrlen);
}
So with a host and no vpnip, the out: label freed the valid list that
getaddrinfo() returned. The CMD_CONNECT path in main() is one such caller:
ret = ovpn_parse_new_peer(ovpn, argv[3], argv[4], argv[5],
argv[6], NULL);
With no host and no vpnip, out: received an uninitialized pointer, not
NULL.
The NULL case looks like it came from commit 0bd9cfebc1c9
("selftests/net: ovpn: fix getaddrinfo memory leak in
ovpn_parse_remote()"). That commit added both of these:
struct addrinfo *result = NULL;
...
freeaddrinfo(result);
result = NULL;
The commit message of 0bd9cfebc1c9 also describes the no-host, no-vpnip
case in 959bc330a439 as an uninitialized pointer.
So the statement "result is NULL when no vpnip was passed (with or
without a remote host)" only holds once 0bd9cfebc1c9 is applied. Should
the tag be this instead?
Fixes: 0bd9cfebc1c9 ("selftests/net: ovpn: fix getaddrinfo memory leak in ovpn_parse_remote()")
The context of the modified hunk has not changed since 959bc330a439. With
Cc: stable, the patch would also apply cleanly to stable trees that lack
0bd9cfebc1c9.
In those trees, wouldn't the new if (result) check test an uninitialized
pointer on the no-host, no-vpnip path, so the patch fixes nothing there?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261022121606.732029-2-antonio%40openvpn.net
Technical Details
Message-ID:
<179275784988.3134.15557022121900385681@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351066-linux-kernel-netdev=dewy.ruReferences:
<20261022121606.732029-8-antonio@openvpn.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351066-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 7/7] selftests: ovpn: avoid calling freeaddrinfo() on NULL Date: Fri, 23 Oct 2026 12:17:29 +0000 Organization: Usenet Network Message-ID: <179275784988.3134.15557022121900385681@kernel.org> References: <20261022121606.732029-8-antonio@openvpn.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="494617"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:0HK/J0jYWKJ2sjQ5uyfG2xKQDuw= sha256:FEshUyA0JuniFNAIk05GDNGwL84z6o09AfIWyZZKHBM= sha1:jsNE9ul5xUgT9ZM19MrxiUKyvm0= sha256:NUVt7j92g1xbuFJ8H/+B54F+sj7qgy8pEMo7WD01r+0= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 38493111499; Fri, 23 Oct 2026 15:21:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.838 X-Spam-Status: No, score=-3.838 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id spnKp92xNOAY; Fri, 23 Oct 2026 15:21:25 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-351066-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 10B7C111493; Fri, 23 Oct 2026 15:21:16 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 9DFE160F430; Fri, 23 Oct 2026 12:18:24 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792757852; b=e+J470ykcibVj7UwFbnedyB2CqzKntZsj5mxCfBtlR27Kmo1ExhIfgj2Xdq/86iXCmaN FuwlnIaLO7ymMmfG1k8jxRmRcB7ouNPRULcgTvAoYnKEBEIvxG41exwCWnmDe6R863cQX GlzXXkmYdfR0ww1WyMLA5FH4IQbM7bYVR+VLe89g9ske9wF6AiKt+A5TyamHlyNwZFGGn VLWDc2xqyLq0E+QidLYNNoZHaoj3YfQC96tumXNQBBGZpS2xLRWMKHHDCmTAYGodFXlju IZ1N9ljxWDC0o1ANROkHN9jZGCJb10+QubzbZKKycWHLvnUCsEh/ON8W7tQpQkmUGzQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792757852; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=ZS0tn8pzkY5HcTliLlyUVVAHnTt7rsmSXjxCSEoW0tY=; b=3wrEDX7coFAbOl69jEUT1gEmFKSUKjjwdw5Oz13sl4rXGdTR0npfyM7mjG04wbYKy2zm oOsjDlGXrLZLfu3f5bPI6z4weAy8hW4VvXdhnx7GXJq0OwAtAFT59M9jYavoR6qvlxJ5x CEyHoJJetDdC7DI+f07l+pH/hOag8Mr2fHlj8dLymiM4xtFilJJutH6zLxGGLVwIpqUXv vjfgq/DUUJj0OAgDKVt7Jtb04H7iJOmCds0upvcjMtYmNKa4JNmMRu5GToFddjIAqE2Mp axvEkVwtxKjbGnu86/tt/0t1ScGxgX+awgripxYUOZHNvbdhQfDmTzg+wwRnbO/O+Sw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VGsDioPt; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DEB560A3839; Fri, 23 Oct 2026 12:17:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VGsDioPt X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792757851; b=poKZTc3qs1/joJF2GPgc7gbUOPY+BHS9ouacAT/35f+mCGL6ioB7d8tQngKm4sKToJd3 MRmkLY2UwjEGO3oykHF/c9Lm5CjEo8sjPhlbQcPFazBhWvQsdXtHl5XjUbDuui4U3n/W2 q/Y1a9oWIXjo7Tc+f6f8bUpJn1Z9W/Qhdl8U81OAJ1mq9lsuFj64zMHM3MJ/a2Ixzn0FX Lf7kDiHgPnce3ODKKE76tsWLjTiiajKrk10Ioroned1HW74+BPfzRaNyKX1uRHslQG1PA jcAGxMhISTahXHZizNhMt4q9D8lFYso5yGWE6Rc8P4XQZ44QehJ1zff4K89cIi2SIuw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792757851; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=ZS0tn8pzkY5HcTliLlyUVVAHnTt7rsmSXjxCSEoW0tY=; b=2xu9nTIyuSPt5QQ2eh/FYcV/uCWIgZwMaj/1Dx9Wrsrpz00zOD9or6pvVqifVKpNuGDL S+kG1T6qLgbvEn3ACPWIM2Gypb7w6HqQXUKhjQoizo1x1hBW4fk5wcmw2Yby/q6lFqnSZ K7RwI8vFw58MRW9gI9kneK+Mwt1YN1kJjYD+4DoHD0txXlohMwbcasw7ghbCz7VK9EuSU cYtAM0nlNqj+6970rZOohcusy9V7OYW2o9rMH/nneLBCnLGUsDX7+QYPlIC6/KVCeXUwT WiRZbMImffYWfgLrQJplCOO/wJz5DWjiqA4Otc/tleCSxRtb9Af9u1bbrSkLENFcikw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VGsDioPt; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3272460A382D; Fri, 23 Oct 2026 12:17:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50E961F01825; Fri, 23 Oct 2026 12:17:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792757850; bh=ZS0tn8pzkY5HcTliLlyUVVAHnTt7rsmSXjxCSEoW0tY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VGsDioPt2yF8NSWQwxO6dGAiED0swBBTttENZgSF5VJMprvGVzbkmlqIPI5N+ePko ySymTd96KuQu+MGJi5ufr3fw4Wsv4OmyEfPCSNwTVDSorJpGMgiAA9iRGwqvQpBYfa 7rs2vd1l2W4oQuJvF612JUWeeEdgdIIsJMLnLqi33j/fgDZIZDWSezGnbyr7CxBSRK 0buO91fKABTT4g0/XZcWX/39eljU3moUSj9DITvkHPY7PA146Cx3fCzf5x0p1NSHZE jVCQ/M/JshqV5wM7PlaM29yl7Fm4uu+h3OWDrhxx2UCsBZkBcMocGZJdnYSWw9wHUQ FrzDKWuH14j0w== X-Cc: netdev@vger.kernel.org, ralf@mandelbit.com, sd@queasysnail.net, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, stable@vger.kernel.org X-In-Reply-To: <20261022121606.732029-8-antonio@openvpn.net> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list