diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-01-24 06:47:48 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-01-24 06:47:48 -0500 |
commit | befddb21c845f8fb49e637997891ef97c6a869dc (patch) | |
tree | 0e7629123184f2dd50291ad6d477b894175f0f26 /net/sysctl_net.c | |
parent | e716efde75267eab919cdb2bef5b2cb77f305326 (diff) | |
parent | 7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619 (diff) |
Merge tag 'v3.8-rc4' into irq/core
Merge Linux 3.8-rc4 before pulling in new commits - we were on an old v3.7 base.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/sysctl_net.c')
-rw-r--r-- | net/sysctl_net.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index e3a6e37cd1c5..9bc6db04be3e 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -38,15 +38,24 @@ static int is_seen(struct ctl_table_set *set) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | /* Return standard mode bits for table entry. */ | 40 | /* Return standard mode bits for table entry. */ |
41 | static int net_ctl_permissions(struct ctl_table_root *root, | 41 | static int net_ctl_permissions(struct ctl_table_header *head, |
42 | struct nsproxy *nsproxy, | ||
43 | struct ctl_table *table) | 42 | struct ctl_table *table) |
44 | { | 43 | { |
44 | struct net *net = container_of(head->set, struct net, sysctls); | ||
45 | kuid_t root_uid = make_kuid(net->user_ns, 0); | ||
46 | kgid_t root_gid = make_kgid(net->user_ns, 0); | ||
47 | |||
45 | /* Allow network administrator to have same access as root. */ | 48 | /* Allow network administrator to have same access as root. */ |
46 | if (capable(CAP_NET_ADMIN)) { | 49 | if (ns_capable(net->user_ns, CAP_NET_ADMIN) || |
50 | uid_eq(root_uid, current_uid())) { | ||
47 | int mode = (table->mode >> 6) & 7; | 51 | int mode = (table->mode >> 6) & 7; |
48 | return (mode << 6) | (mode << 3) | mode; | 52 | return (mode << 6) | (mode << 3) | mode; |
49 | } | 53 | } |
54 | /* Allow netns root group to have the same access as the root group */ | ||
55 | if (gid_eq(root_gid, current_gid())) { | ||
56 | int mode = (table->mode >> 3) & 7; | ||
57 | return (mode << 3) | mode; | ||
58 | } | ||
50 | return table->mode; | 59 | return table->mode; |
51 | } | 60 | } |
52 | 61 | ||