]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.60/netlink-do-not-subscribe-to-non-existent-groups.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.14.60 / netlink-do-not-subscribe-to-non-existent-groups.patch
CommitLineData
2c643bb0
GKH
1From foo@baz Wed Aug 1 08:19:32 CEST 2018
2From: Dmitry Safonov <dima@arista.com>
3Date: Fri, 27 Jul 2018 16:54:44 +0100
4Subject: netlink: Do not subscribe to non-existent groups
5
6From: Dmitry Safonov <dima@arista.com>
7
8[ Upstream commit 7acf9d4237c46894e0fa0492dd96314a41742e84 ]
9
10Make ABI more strict about subscribing to group > ngroups.
11Code doesn't check for that and it looks bogus.
12(one can subscribe to non-existing group)
13Still, it's possible to bind() to all possible groups with (-1)
14
15Cc: "David S. Miller" <davem@davemloft.net>
16Cc: Herbert Xu <herbert@gondor.apana.org.au>
17Cc: Steffen Klassert <steffen.klassert@secunet.com>
18Cc: netdev@vger.kernel.org
19Signed-off-by: Dmitry Safonov <dima@arista.com>
20Signed-off-by: David S. Miller <davem@davemloft.net>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22---
23 net/netlink/af_netlink.c | 1 +
24 1 file changed, 1 insertion(+)
25
26--- a/net/netlink/af_netlink.c
27+++ b/net/netlink/af_netlink.c
28@@ -976,6 +976,7 @@ static int netlink_bind(struct socket *s
29 if (err)
30 return err;
31 }
32+ groups &= (1UL << nlk->ngroups) - 1;
33
34 bound = nlk->bound;
35 if (bound) {