diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-08-10 17:36:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-15 00:08:58 -0400 |
commit | e79c6a4fc923eed2bdd3b716e0f01414847db90a (patch) | |
tree | ad2cc7b3534b8767f507caf65b093fe4fca43fa9 /fs/proc | |
parent | c110486f6cb240f36ec143cad6628d52c071f529 (diff) |
net: make net namespace sysctls belong to container's owner
If net namespace is attached to a user namespace let's make container's
root owner of sysctls affecting said network namespace instead of global
root.
This also allows us to clean up net_ctl_permissions() because we do not
need to fudge permissions anymore for the container's owner since it now
owns the objects in question.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/proc_sysctl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index b59db94d2ff4..62d8c6975d34 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -430,6 +430,7 @@ static int sysctl_perm(struct ctl_table_header *head, struct ctl_table *table, i | |||
430 | static struct inode *proc_sys_make_inode(struct super_block *sb, | 430 | static struct inode *proc_sys_make_inode(struct super_block *sb, |
431 | struct ctl_table_header *head, struct ctl_table *table) | 431 | struct ctl_table_header *head, struct ctl_table *table) |
432 | { | 432 | { |
433 | struct ctl_table_root *root = head->root; | ||
433 | struct inode *inode; | 434 | struct inode *inode; |
434 | struct proc_inode *ei; | 435 | struct proc_inode *ei; |
435 | 436 | ||
@@ -457,6 +458,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, | |||
457 | if (is_empty_dir(head)) | 458 | if (is_empty_dir(head)) |
458 | make_empty_dir_inode(inode); | 459 | make_empty_dir_inode(inode); |
459 | } | 460 | } |
461 | |||
462 | if (root->set_ownership) | ||
463 | root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); | ||
464 | |||
460 | out: | 465 | out: |
461 | return inode; | 466 | return inode; |
462 | } | 467 | } |