Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe136069 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Treehugger Robot
Browse files

Revert "genetlink: add CAP_NET_ADMIN test for multicast bind"



This reverts commit 30cc13fe.

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: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 9e0e7647
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
 */
struct genl_multicast_group {
	char			name[GENL_NAMSIZ];
	u8			flags;
};

struct genl_ops;
+0 −28
Original line number Diff line number Diff line
@@ -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 */