Skip to content

Commit 7acf9d4

Browse files
0x7f454c46davem330
authored andcommitted
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]> Cc: [email protected] Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9939a46 commit 7acf9d4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/netlink/af_netlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
10081008
if (err)
10091009
return err;
10101010
}
1011+
groups &= (1UL << nlk->ngroups) - 1;
10111012

10121013
bound = nlk->bound;
10131014
if (bound) {

0 commit comments

Comments
 (0)