diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-01 00:25:30 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-04 14:34:11 -0500 |
commit | 3c0411846118a578de3a979faf2da3ab5fb81179 (patch) | |
tree | 4609996bb8fdad235f21d0ec87bf1307da8738c0 /kernel/user_namespace.c | |
parent | ff24870f46d51d79fc74a241fd7c12ccb933c69f (diff) |
switch the rest of proc_ns_operations to working with &...->ns
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r-- | kernel/user_namespace.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index fde584082673..1ab2209228ff 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -841,6 +841,11 @@ static bool new_idmap_permitted(const struct file *file, | |||
841 | return false; | 841 | return false; |
842 | } | 842 | } |
843 | 843 | ||
844 | static inline struct user_namespace *to_user_ns(struct ns_common *ns) | ||
845 | { | ||
846 | return container_of(ns, struct user_namespace, ns); | ||
847 | } | ||
848 | |||
844 | static void *userns_get(struct task_struct *task) | 849 | static void *userns_get(struct task_struct *task) |
845 | { | 850 | { |
846 | struct user_namespace *user_ns; | 851 | struct user_namespace *user_ns; |
@@ -849,17 +854,17 @@ static void *userns_get(struct task_struct *task) | |||
849 | user_ns = get_user_ns(__task_cred(task)->user_ns); | 854 | user_ns = get_user_ns(__task_cred(task)->user_ns); |
850 | rcu_read_unlock(); | 855 | rcu_read_unlock(); |
851 | 856 | ||
852 | return user_ns; | 857 | return user_ns ? &user_ns->ns : NULL; |
853 | } | 858 | } |
854 | 859 | ||
855 | static void userns_put(void *ns) | 860 | static void userns_put(void *ns) |
856 | { | 861 | { |
857 | put_user_ns(ns); | 862 | put_user_ns(to_user_ns(ns)); |
858 | } | 863 | } |
859 | 864 | ||
860 | static int userns_install(struct nsproxy *nsproxy, void *ns) | 865 | static int userns_install(struct nsproxy *nsproxy, void *ns) |
861 | { | 866 | { |
862 | struct user_namespace *user_ns = ns; | 867 | struct user_namespace *user_ns = to_user_ns(ns); |
863 | struct cred *cred; | 868 | struct cred *cred; |
864 | 869 | ||
865 | /* Don't allow gaining capabilities by reentering | 870 | /* Don't allow gaining capabilities by reentering |
@@ -890,8 +895,7 @@ static int userns_install(struct nsproxy *nsproxy, void *ns) | |||
890 | 895 | ||
891 | static unsigned int userns_inum(void *ns) | 896 | static unsigned int userns_inum(void *ns) |
892 | { | 897 | { |
893 | struct user_namespace *user_ns = ns; | 898 | return ((struct ns_common *)ns)->inum; |
894 | return user_ns->ns.inum; | ||
895 | } | 899 | } |
896 | 900 | ||
897 | const struct proc_ns_operations userns_operations = { | 901 | const struct proc_ns_operations userns_operations = { |