Files
linux/net
Nikolay Aleksandrov a60a83dd65 net: netlink: cap max groups which will be considered in netlink_bind()
commit 3a20773bee upstream.

Since nl_groups is a u32 we can't bind more groups via ->bind
(netlink_bind) call, but netlink has supported more groups via
setsockopt() for a long time and thus nlk->ngroups could be over 32.
Recently I added support for per-vlan notifications and increased the
groups to 33 for NETLINK_ROUTE which exposed an old bug in the
netlink_bind() code causing out-of-bounds access on archs where unsigned
long is 32 bits via test_bit() on a local variable. Fix this by capping the
maximum groups in netlink_bind() to BITS_PER_TYPE(u32), effectively
capping them at 32 which is the minimum of allocated groups and the
maximum groups which can be bound via netlink_bind().

CC: Christophe Leroy <christophe.leroy@c-s.fr>
CC: Richard Guy Briggs <rgb@redhat.com>
Fixes: 4f52090052 ("netlink: have netlink per-protocol bind function return an error code.")
Reported-by: Erhard F. <erhard_f@mailbox.org>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-15 17:01:57 +09:00
..
2015-03-02 16:43:41 -05:00
2023-05-15 12:38:05 +09:00
2023-05-15 16:07:59 +09:00
2023-05-15 14:29:05 +09:00
2023-05-15 13:49:35 +09:00
2016-10-20 11:23:08 -04:00
2023-05-15 12:05:35 +09:00
2023-05-15 15:17:38 +09:00
2023-05-15 16:48:22 +09:00
2023-05-15 14:29:05 +09:00
2023-05-15 10:49:15 +09:00
2016-08-17 19:36:23 -04:00
2023-05-15 16:34:23 +09:00