Skip to content

Commit 2433c8f

Browse files
ebiedermtorvalds
authored andcommitted
net: Update the sysctl permissions handler to test effective uid/gid
Modify the code to use current_euid(), and in_egroup_p, as in done in fs/proc/proc_sysctl.c:test_perm() Cc: [email protected] Reviewed-by: Eric Sandeen <[email protected]> Reported-by: Eric Sandeen <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 13caa8e commit 2433c8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/sysctl_net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ static int net_ctl_permissions(struct ctl_table_header *head,
4747

4848
/* Allow network administrator to have same access as root. */
4949
if (ns_capable(net->user_ns, CAP_NET_ADMIN) ||
50-
uid_eq(root_uid, current_uid())) {
50+
uid_eq(root_uid, current_euid())) {
5151
int mode = (table->mode >> 6) & 7;
5252
return (mode << 6) | (mode << 3) | mode;
5353
}
5454
/* Allow netns root group to have the same access as the root group */
55-
if (gid_eq(root_gid, current_gid())) {
55+
if (in_egroup_p(root_gid)) {
5656
int mode = (table->mode >> 3) & 7;
5757
return (mode << 3) | mode;
5858
}

0 commit comments

Comments
 (0)