Revert "genetlink: add CAP_NET_ADMIN test for multicast bind"

This reverts commit 30cc13fe89.

It does not have a direct commit relation in upstream, and was lovingly
hand-crafted just for the 4.19.y kernel tree with the hope that it would
be useful to someone.

Unfortunately for us, it breaks the Android kernel abi and so, if it is
really needed in the future, must be brought back in an abi-safe way
then.

Bug: 161946584
Change-Id: I12a953b74673556a3b94a0b8bbdc453f3c08db04
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2023-12-18 19:04:14 +00:00 committed by Treehugger Robot
parent 9e0e764749
commit fe1360692a
2 changed files with 0 additions and 29 deletions

View file

@ -14,7 +14,6 @@
*/
struct genl_multicast_group {
char name[GENL_NAMSIZ];
u8 flags;
};
struct genl_ops;

View file

@ -961,39 +961,11 @@ static struct genl_family genl_ctrl __ro_after_init = {
.netnsok = true,
};
static int genl_bind(struct net *net, int group)
{
struct genl_family *f;
int err = 0;
unsigned int id;
down_read(&cb_lock);
idr_for_each_entry(&genl_fam_idr, f, id) {
if (group >= f->mcgrp_offset &&
group < f->mcgrp_offset + f->n_mcgrps) {
int fam_grp = group - f->mcgrp_offset;
if (!f->netnsok && net != &init_net)
err = -ENOENT;
else if (f->mcast_bind)
err = f->mcast_bind(net, fam_grp);
else
err = 0;
break;
}
}
up_read(&cb_lock);
return err;
}
static int __net_init genl_pernet_init(struct net *net)
{
struct netlink_kernel_cfg cfg = {
.input = genl_rcv,
.flags = NL_CFG_F_NONROOT_RECV,
.bind = genl_bind,
};
/* we'll bump the group number right afterwards */