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: stable@vger.kernel.org
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Eric W. Biederman and committed by Linus Torvalds 2433c8f0 13caa8ed

Changed files
+2 -2
net
+2 -2
net/sysctl_net.c
··· 47 47 48 48 /* Allow network administrator to have same access as root. */ 49 49 if (ns_capable(net->user_ns, CAP_NET_ADMIN) || 50 - uid_eq(root_uid, current_uid())) { 50 + uid_eq(root_uid, current_euid())) { 51 51 int mode = (table->mode >> 6) & 7; 52 52 return (mode << 6) | (mode << 3) | mode; 53 53 } 54 54 /* 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)) { 56 56 int mode = (table->mode >> 3) & 7; 57 57 return (mode << 3) | mode; 58 58 }