netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ll_map: Fix descriptor leak in ll_link_get()
@ 2024-02-07 20:32 Maks Mishin
  2024-02-08 13:33 ` Donald Hunter
  2024-02-08 16:56 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Maks Mishin @ 2024-02-07 20:32 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Maks Mishin, netdev

Found by RASU JSC

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.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)
-- 
2.30.2


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-07 20:32 [PATCH] ll_map: Fix descriptor leak in ll_link_get() Maks Mishin
2024-02-08 13:33 ` Donald Hunter
2024-02-08 16:56 ` 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).