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

Commit ee9bfb84 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "genetlink: add CAP_NET_ADMIN test for multicast bind"



This reverts commit 263bffd2 which does
not have a direct relation to an upstream commit.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I8ddc8a86b47a9560115ccb83fc50d522436d0b3b
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 4684391c
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 −32
Original line number Diff line number Diff line
@@ -989,43 +989,11 @@ static struct genl_family genl_ctrl __ro_after_init = {
	.netnsok = true,
};

static int genl_bind(struct net *net, int group)
{
	const struct genl_family *family;
	unsigned int id;
	int ret = 0;

	genl_lock_all();

	idr_for_each_entry(&genl_fam_idr, family, id) {
		const struct genl_multicast_group *grp;
		int i;

		if (family->n_mcgrps == 0)
			continue;

		i = group - family->mcgrp_offset;
		if (i < 0 || i >= family->n_mcgrps)
			continue;

		grp = &family->mcgrps[i];
		if ((grp->flags & GENL_UNS_ADMIN_PERM) &&
		    !ns_capable(net->user_ns, CAP_NET_ADMIN))
			ret = -EPERM;

		break;
	}

	genl_unlock_all();
	return ret;
}

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 */