Skip to contentSkip to conversation

netlink: Do not subscribe to non-existent groups

PATCH In review Dmitry Safonov 2 participants 2 messages Jul 27, 2018 – Jul 29, 2018

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

PATCH 1/1 netlink: Do not subscribe to non-existent groups

Make ABI more strict about subscribing to group > ngroups. Code doesn't check for that and it looks bogus.
(one can subscribe to non-existing group)
Still, it's possible to bind() to all possible groups with (-1)

Cc "David S. Miller" <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Steffen Klassert <[email protected]>
---
 net/netlink/af_netlink.c | 1 +
 1 file changed, 1 insertion(+)
net/netlink/af_netlink.c +1 -0
index 393573a99a5a..ac805caed2e2 100644
@@ -1008,6 +1008,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
 		if (err)
 			return err;
 	}
+	groups &= (1UL << nlk->ngroups) - 1;
 
 	bound = nlk->bound;
 	if (bound) {
Signature · 1 line
2.13.6
maintainer
#1 lore raw

From: Dmitry Safonov <[email protected]>
Date: Fri, 27 Jul 2018 16:54:44 +0100

Quoted 10 lines

Make ABI more strict about subscribing to group > ngroups. Code doesn't check for that and it looks bogus.
(one can subscribe to non-existing group)
Still, it's possible to bind() to all possible groups with (-1)

Cc "David S. Miller" <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Steffen Klassert <[email protected]>

Applied and queued up for -stable, thanks.