[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240208085639.65d037ee@hermes.local>
Date: Thu, 8 Feb 2024 08:56:39 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Maks Mishin <maks.mishinfz@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] ll_map: Fix descriptor leak in ll_link_get()
On Wed, 7 Feb 2024 23:32:39 +0300
Maks Mishin <maks.mishinfz@...il.com> wrote:
> Found by RASU JSC
>
> Signed-off-by: Maks Mishin <maks.mishinFZ@...il.com>
> ---
> lib/ll_map.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ll_map.c b/lib/ll_map.c
> index 8970c20f..711708a5 100644
> --- a/lib/ll_map.c
> +++ b/lib/ll_map.c
> @@ -278,8 +278,10 @@ static int ll_link_get(const char *name, int index)
> struct nlmsghdr *answer;
> int rc = 0;
>
> - if (rtnl_open(&rth, 0) < 0)
> + if (rtnl_open(&rth, 0) < 0) {
> + rtnl_close(&rth);
> return 0;
> + }
>
> addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filt_mask);
> if (name)
Same as previous patch.
This doesn't make sense, the error path in rtnl_open cleans up
itself. Do you have a reproducer or is this just some static analyzer?
Powered by blists - more mailing lists