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 /ipc | |
| 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 'ipc')
| -rw-r--r-- | ipc/namespace.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c index 177fa9db391d..3c1e8d3bd7d3 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
| @@ -149,6 +149,11 @@ void put_ipc_ns(struct ipc_namespace *ns) | |||
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static inline struct ipc_namespace *to_ipc_ns(struct ns_common *ns) | ||
| 153 | { | ||
| 154 | return container_of(ns, struct ipc_namespace, ns); | ||
| 155 | } | ||
| 156 | |||
| 152 | static void *ipcns_get(struct task_struct *task) | 157 | static void *ipcns_get(struct task_struct *task) |
| 153 | { | 158 | { |
| 154 | struct ipc_namespace *ns = NULL; | 159 | struct ipc_namespace *ns = NULL; |
| @@ -160,17 +165,17 @@ static void *ipcns_get(struct task_struct *task) | |||
| 160 | ns = get_ipc_ns(nsproxy->ipc_ns); | 165 | ns = get_ipc_ns(nsproxy->ipc_ns); |
| 161 | task_unlock(task); | 166 | task_unlock(task); |
| 162 | 167 | ||
| 163 | return ns; | 168 | return ns ? &ns->ns : NULL; |
| 164 | } | 169 | } |
| 165 | 170 | ||
| 166 | static void ipcns_put(void *ns) | 171 | static void ipcns_put(void *ns) |
| 167 | { | 172 | { |
| 168 | return put_ipc_ns(ns); | 173 | return put_ipc_ns(to_ipc_ns(ns)); |
| 169 | } | 174 | } |
| 170 | 175 | ||
| 171 | static int ipcns_install(struct nsproxy *nsproxy, void *new) | 176 | static int ipcns_install(struct nsproxy *nsproxy, void *new) |
| 172 | { | 177 | { |
| 173 | struct ipc_namespace *ns = new; | 178 | struct ipc_namespace *ns = to_ipc_ns(new); |
| 174 | if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || | 179 | if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || |
| 175 | !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) | 180 | !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) |
| 176 | return -EPERM; | 181 | return -EPERM; |
| @@ -184,9 +189,7 @@ static int ipcns_install(struct nsproxy *nsproxy, void *new) | |||
| 184 | 189 | ||
| 185 | static unsigned int ipcns_inum(void *vp) | 190 | static unsigned int ipcns_inum(void *vp) |
| 186 | { | 191 | { |
| 187 | struct ipc_namespace *ns = vp; | 192 | return ((struct ns_common *)vp)->inum; |
| 188 | |||
| 189 | return ns->ns.inum; | ||
| 190 | } | 193 | } |
| 191 | 194 | ||
| 192 | const struct proc_ns_operations ipcns_operations = { | 195 | const struct proc_ns_operations ipcns_operations = { |
