Skip to contentSkip to conversation

net: Fix permission check in netlink_connect()

PATCH Applied Mike Pecovnik 2 participants 2 messages Feb 24, 2014 – Feb 25, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Fix permission check in netlink_connect()

netlink_sendmsg() was changed to prevent non-root processes from sending messages with dst_pid != 0.
netlink_connect() however still only checks if nladdr->nl_groups is set. This patch modifies netlink_connect() to check for the same condition.

---
 net/netlink/af_netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netlink/af_netlink.c +2 -2
index fdf5135..04748ab6 100644
@@ -1489,8 +1489,8 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
 	if (addr->sa_family != AF_NETLINK)
 		return -EINVAL;
 
-	/* Only superuser is allowed to send multicasts */
-	if (nladdr->nl_groups && !netlink_capable(sock, NL_CFG_F_NONROOT_SEND))
+	if ((nladdr->nl_groups || nladdr->nl_pid) &&
+	    !netlink_capable(sock, NL_CFG_F_NONROOT_SEND))
 		return -EPERM;
 
 	if (!nlk->portid)
Signature · 1 line
1.8.3.2
maintainer Applied
#1 lore raw

From: Mike Pecovnik <[email protected]>
Date: Mon, 24 Feb 2014 21:11:16 +0100

Quoted 6 lines

netlink_sendmsg() was changed to prevent non-root processes from sending messages with dst_pid != 0.
netlink_connect() however still only checks if nladdr->nl_groups is set. This patch modifies netlink_connect() to check for the same condition.

Applied, thank you.