lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu,  8 Feb 2024 09:26:27 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Maks Mishin <maks.mishinfz@...il.com>,
	Maks Mishin <maks.mishinFZ@...il.com>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen()

From: Maks Mishin <maks.mishinfz@...il.com>

Use the same pattern for handling rtnl_listen() errors that
is used across other iproute2 commands. All other commands
exit with status of 2 if rtnl_listen fails.

Reported-off-by: Maks Mishin <maks.mishinFZ@...il.com>
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
 genl/ctrl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/genl/ctrl.c b/genl/ctrl.c
index bae73a54bc37..72a9b01302cf 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -334,8 +334,9 @@ static int ctrl_listen(int argc, char **argv)
 	}
 
 	if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0)
-		return -1;
-
+		exit(2);
+	
+	rtnl_close(&rth);	
 	return 0;
 }
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ