Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346332
b: refs/heads/master
c: c450f37
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman committed Nov 20, 2012
1 parent 73d9534 commit 61de54c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9f238c3041e2582a710e75910c8cbf2a98e51b2
refs/heads/master: c450f371d48557e3e0fa510a4af27b92f0d8c4cc
12 changes: 10 additions & 2 deletions trunk/kernel/user_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static int uid_m_show(struct seq_file *seq, void *v)
struct user_namespace *lower_ns;
uid_t lower;

lower_ns = current_user_ns();
lower_ns = seq_user_ns(seq);
if ((lower_ns == ns) && lower_ns->parent)
lower_ns = lower_ns->parent;

Expand All @@ -412,7 +412,7 @@ static int gid_m_show(struct seq_file *seq, void *v)
struct user_namespace *lower_ns;
gid_t lower;

lower_ns = current_user_ns();
lower_ns = seq_user_ns(seq);
if ((lower_ns == ns) && lower_ns->parent)
lower_ns = lower_ns->parent;

Expand Down Expand Up @@ -688,10 +688,14 @@ ssize_t proc_uid_map_write(struct file *file, const char __user *buf, size_t siz
{
struct seq_file *seq = file->private_data;
struct user_namespace *ns = seq->private;
struct user_namespace *seq_ns = seq_user_ns(seq);

if (!ns->parent)
return -EPERM;

if ((seq_ns != ns) && (seq_ns != ns->parent))
return -EPERM;

return map_write(file, buf, size, ppos, CAP_SETUID,
&ns->uid_map, &ns->parent->uid_map);
}
Expand All @@ -700,10 +704,14 @@ ssize_t proc_gid_map_write(struct file *file, const char __user *buf, size_t siz
{
struct seq_file *seq = file->private_data;
struct user_namespace *ns = seq->private;
struct user_namespace *seq_ns = seq_user_ns(seq);

if (!ns->parent)
return -EPERM;

if ((seq_ns != ns) && (seq_ns != ns->parent))
return -EPERM;

return map_write(file, buf, size, ppos, CAP_SETGID,
&ns->gid_map, &ns->parent->gid_map);
}
Expand Down

0 comments on commit 61de54c

Please sign in to comment.