[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z02kF5egZ//yB7Tf@duo.ucw.cz>
Date: Mon, 2 Dec 2024 13:12:07 +0100
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Zhu Jun <zhujun2@...s.chinamobile.com>,
Andrii Nakryiko <andrii@...nel.org>, ast@...nel.org,
daniel@...earbox.net, bpf@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 4.19 02/21] samples/bpf: Fix a resource leak
Hi!
> [ Upstream commit f3ef53174b23246fe9bc2bbc2542f3a3856fa1e2 ]
>
> The opened file should be closed in show_sockopts(), otherwise resource
> leak will occur that this problem was discovered by reading code
Well, code exits when this fails, so there's really no leak.
Best regards,
Pavel
> +++ b/samples/bpf/test_cgrp2_sock.c
> @@ -174,8 +174,10 @@ static int show_sockopts(int family)
> return 1;
> }
>
> - if (get_bind_to_device(sd, name, sizeof(name)) < 0)
> + if (get_bind_to_device(sd, name, sizeof(name)) < 0) {
> + close(sd);
> return 1;
> + }
>
> mark = get_somark(sd);
> prio = get_priority(sd);
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists