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:   Mon,  3 May 2021 12:36:31 +0200
From:   Florian Westphal <fw@...len.de>
To:     <netdev@...r.kernel.org>
Cc:     Florian Westphal <fw@...len.de>
Subject: [PATCH iproute2] mptcp: avoid uninitialised errno usage

The function called *might* set errno based on errno value in NLMSG_ERROR
message, but in case no such message exists errno is left alone.

This may cause ip to fail with
    "can't subscribe to mptcp events: Success"

on kernels that support mptcp but lack event support (all kernels <= 5.11).

Set errno to a meaningful value.  This will then still exit with the
more specific 'permission denied' or some such when called by process
that lacks CAP_NET_ADMIN on 5.12 and later.

Fixes: ff619e4fd370 ("mptcp: add support for event monitoring")
Signed-off-by: Florian Westphal <fw@...len.de>
---
 ip/ipmptcp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index 5f490f0026d9..504b5b2f5329 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -491,6 +491,9 @@ out:
 
 static int mptcp_monitor(void)
 {
+	/* genl_add_mcast_grp may or may not set errno */
+	errno = EOPNOTSUPP;
+
 	if (genl_add_mcast_grp(&genl_rth, genl_family, MPTCP_PM_EV_GRP_NAME) < 0) {
 		perror("can't subscribe to mptcp events");
 		return 1;
-- 
2.26.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ