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

Commit 01a16b21 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

netlink: kill eff_cap from struct netlink_skb_parms



Netlink message processing in the kernel is synchronous these days,
capabilities can be checked directly in security_netlink_recv() from
the current process.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Reviewed-by: default avatarJames Morris <jmorris@namei.org>
[chrisw: update to include pohmelfs and uvesafb]
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63f97425
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2177,7 +2177,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
		return;
		return;
	}
	}


	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) {
	if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) {
		retcode = ERR_PERM;
		retcode = ERR_PERM;
		goto fail;
		goto fail;
	}
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -134,7 +134,7 @@ static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
{
{
	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);


	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
		return;
		return;


	spin_lock(&receiving_list_lock);
	spin_lock(&receiving_list_lock);
+1 −1
Original line number Original line Diff line number Diff line
@@ -525,7 +525,7 @@ static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *n
{
{
	int err;
	int err;


	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
		return;
		return;


	switch (msg->flags) {
	switch (msg->flags) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -73,7 +73,7 @@ static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *ns
	struct uvesafb_task *utask;
	struct uvesafb_task *utask;
	struct uvesafb_ktask *task;
	struct uvesafb_ktask *task;


	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
		return;
		return;


	if (msg->seq >= UVESAFB_TASKS_MAX)
	if (msg->seq >= UVESAFB_TASKS_MAX)
+0 −1
Original line number Original line Diff line number Diff line
@@ -160,7 +160,6 @@ struct netlink_skb_parms {
	struct ucred		creds;		/* Skb credentials	*/
	struct ucred		creds;		/* Skb credentials	*/
	__u32			pid;
	__u32			pid;
	__u32			dst_group;
	__u32			dst_group;
	kernel_cap_t		eff_cap;
};
};


#define NETLINK_CB(skb)		(*(struct netlink_skb_parms*)&((skb)->cb))
#define NETLINK_CB(skb)		(*(struct netlink_skb_parms*)&((skb)->cb))
Loading