[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2zfwbrsh1.fsf@gmail.com>
Date: Thu, 08 Feb 2024 13:33:14 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Maks Mishin <maks.mishinfz@...il.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>, netdev@...r.kernel.org
Subject: Re: [PATCH] ll_map: Fix descriptor leak in ll_link_get()
Maks Mishin <maks.mishinfz@...il.com> writes:
> 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);
There's no need to call rtnl_close() if the call to rtnl_open() just
failed.
> return 0;
> + }
>
> addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filt_mask);
> if (name)
Powered by blists - more mailing lists