netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iplink: Fix descriptor leak in get_link_kind()
@ 2024-02-07 21:04 Maks Mishin
  2024-02-08 17:05 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Maks Mishin @ 2024-02-07 21:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Maks Mishin, netdev

Found by RASU JSC

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
 ip/iplink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ip/iplink.c b/ip/iplink.c
index 95314af5..7e31b95c 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -168,6 +168,9 @@ struct link_util *get_link_kind(const char *id)
 
 	snprintf(buf, sizeof(buf), "%s_link_util", id);
 	l = dlsym(dlh, buf);
+	if (dlh != NULL)
+		dlclose(dlh);
+
 	if (l == NULL)
 		return NULL;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iplink: Fix descriptor leak in get_link_kind()
  2024-02-07 21:04 [PATCH] iplink: Fix descriptor leak in get_link_kind() Maks Mishin
@ 2024-02-08 17:05 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2024-02-08 17:05 UTC (permalink / raw)
  To: Maks Mishin; +Cc: netdev

On Thu,  8 Feb 2024 00:04:50 +0300
Maks Mishin <maks.mishinfz@gmail.com> wrote:

> Found by RASU JSC
> 
> Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
> ---
>  ip/iplink.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 95314af5..7e31b95c 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -168,6 +168,9 @@ struct link_util *get_link_kind(const char *id)
>  
>  	snprintf(buf, sizeof(buf), "%s_link_util", id);
>  	l = dlsym(dlh, buf);
> +	if (dlh != NULL)
> +		dlclose(dlh);
> +
>  	if (l == NULL)
>  		return NULL;
>  

NAK this will break the caching of BODY.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-08 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-07 21:04 [PATCH] iplink: Fix descriptor leak in get_link_kind() Maks Mishin
2024-02-08 17:05 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).