[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <41bc10eb-8e0f-422d-932f-1135bee567a8@openvpn.net>
Date: Tue, 13 May 2025 10:02:25 +0200
From: Antonio Quartulli <antonio@...nvpn.net>
To: Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Cc: Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCH net-next 05/10] selftest/net/ovpn: fix crash in case of
getaddrinfo() failure
On 13/05/2025 09:48, Paolo Abeni wrote:
> On 5/9/25 4:26 PM, Antonio Quartulli wrote:
>> getaddrinfo() may fail with error code different from EAI_FAIL
>> or EAI_NONAME, however in this case we still try to free the
>> results object, thus leading to a crash.
>>
>> Fix this by bailing out on any possible error.
>>
>> Fixes: 959bc330a439 ("testing/selftests: add test tool and scripts for ovpn module")
>> Signed-off-by: Antonio Quartulli <antonio@...nvpn.net>
>> ---
>> tools/testing/selftests/net/ovpn/ovpn-cli.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/net/ovpn/ovpn-cli.c b/tools/testing/selftests/net/ovpn/ovpn-cli.c
>> index 69e41fc07fbc..c6372a1b4728 100644
>> --- a/tools/testing/selftests/net/ovpn/ovpn-cli.c
>> +++ b/tools/testing/selftests/net/ovpn/ovpn-cli.c
>> @@ -1753,8 +1753,11 @@ static int ovpn_parse_remote(struct ovpn_ctx *ovpn, const char *host,
>>
>> if (host) {
>> ret = getaddrinfo(host, service, &hints, &result);
>> - if (ret == EAI_NONAME || ret == EAI_FAIL)
>> + if (ret) {
>> + fprintf(stderr, "getaddrinfo on remote error: %s\n",
>> + gai_strerror(ret));
>> return -1;
>
> Side note: you could instead use the libcall error(), even if at this
> point it would be a quite largish self-test refactor.
Thanks for the hint!
I'll add this to my todo list and I'll do a full ovpn-cli.c revamp with
error().
Regards,
>
> /P
>
--
Antonio Quartulli
OpenVPN Inc.
Powered by blists - more mailing lists