Loading fs/namespace.c +3 −10 Original line number Diff line number Diff line Loading @@ -3149,7 +3149,7 @@ bool fs_fully_visible(struct file_system_type *type) return visible; } static void *mntns_get(struct task_struct *task) static struct ns_common *mntns_get(struct task_struct *task) { struct ns_common *ns = NULL; struct nsproxy *nsproxy; Loading @@ -3165,12 +3165,12 @@ static void *mntns_get(struct task_struct *task) return ns; } static void mntns_put(void *ns) static void mntns_put(struct ns_common *ns) { put_mnt_ns(to_mnt_ns(ns)); } static int mntns_install(struct nsproxy *nsproxy, void *ns) static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns) { struct fs_struct *fs = current->fs; struct mnt_namespace *mnt_ns = to_mnt_ns(ns); Loading Loading @@ -3203,17 +3203,10 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns) return 0; } static unsigned int mntns_inum(void *ns) { struct ns_common *p = ns; return p->inum; } const struct proc_ns_operations mntns_operations = { .name = "mnt", .type = CLONE_NEWNS, .get = mntns_get, .put = mntns_put, .install = mntns_install, .inum = mntns_inum, }; fs/proc/inode.c +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ static void proc_evict_inode(struct inode *inode) struct proc_dir_entry *de; struct ctl_table_header *head; const struct proc_ns_operations *ns_ops; void *ns; struct ns_common *ns; truncate_inode_pages_final(&inode->i_data); clear_inode(inode); Loading fs/proc/namespaces.c +4 −4 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb, struct inode *inode; struct proc_inode *ei; struct qstr qname = { .name = "", }; void *ns; struct ns_common *ns; ns = ns_ops->get(task); if (!ns) Loading @@ -76,7 +76,7 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb, return ERR_PTR(-ENOMEM); } inode = iget_locked(sb, ns_ops->inum(ns)); inode = iget_locked(sb, ns->inum); if (!inode) { dput(dentry); ns_ops->put(ns); Loading Loading @@ -144,7 +144,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl struct proc_inode *ei = PROC_I(inode); const struct proc_ns_operations *ns_ops = ei->ns.ns_ops; struct task_struct *task; void *ns; struct ns_common *ns; char name[50]; int res = -EACCES; Loading @@ -160,7 +160,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl if (!ns) goto out_put_task; snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns_ops->inum(ns)); snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns->inum); res = readlink_copy(buffer, buflen, name); ns_ops->put(ns); out_put_task: Loading include/linux/proc_ns.h +5 −5 Original line number Diff line number Diff line Loading @@ -6,18 +6,18 @@ struct pid_namespace; struct nsproxy; struct ns_common; struct proc_ns_operations { const char *name; int type; void *(*get)(struct task_struct *task); void (*put)(void *ns); int (*install)(struct nsproxy *nsproxy, void *ns); unsigned int (*inum)(void *ns); struct ns_common *(*get)(struct task_struct *task); void (*put)(struct ns_common *ns); int (*install)(struct nsproxy *nsproxy, struct ns_common *ns); }; struct proc_ns { void *ns; struct ns_common *ns; const struct proc_ns_operations *ns_ops; }; Loading ipc/namespace.c +3 −9 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ static inline struct ipc_namespace *to_ipc_ns(struct ns_common *ns) return container_of(ns, struct ipc_namespace, ns); } static void *ipcns_get(struct task_struct *task) static struct ns_common *ipcns_get(struct task_struct *task) { struct ipc_namespace *ns = NULL; struct nsproxy *nsproxy; Loading @@ -168,12 +168,12 @@ static void *ipcns_get(struct task_struct *task) return ns ? &ns->ns : NULL; } static void ipcns_put(void *ns) static void ipcns_put(struct ns_common *ns) { return put_ipc_ns(to_ipc_ns(ns)); } static int ipcns_install(struct nsproxy *nsproxy, void *new) static int ipcns_install(struct nsproxy *nsproxy, struct ns_common *new) { struct ipc_namespace *ns = to_ipc_ns(new); if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || Loading @@ -187,16 +187,10 @@ static int ipcns_install(struct nsproxy *nsproxy, void *new) return 0; } static unsigned int ipcns_inum(void *vp) { return ((struct ns_common *)vp)->inum; } const struct proc_ns_operations ipcns_operations = { .name = "ipc", .type = CLONE_NEWIPC, .get = ipcns_get, .put = ipcns_put, .install = ipcns_install, .inum = ipcns_inum, }; Loading
fs/namespace.c +3 −10 Original line number Diff line number Diff line Loading @@ -3149,7 +3149,7 @@ bool fs_fully_visible(struct file_system_type *type) return visible; } static void *mntns_get(struct task_struct *task) static struct ns_common *mntns_get(struct task_struct *task) { struct ns_common *ns = NULL; struct nsproxy *nsproxy; Loading @@ -3165,12 +3165,12 @@ static void *mntns_get(struct task_struct *task) return ns; } static void mntns_put(void *ns) static void mntns_put(struct ns_common *ns) { put_mnt_ns(to_mnt_ns(ns)); } static int mntns_install(struct nsproxy *nsproxy, void *ns) static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns) { struct fs_struct *fs = current->fs; struct mnt_namespace *mnt_ns = to_mnt_ns(ns); Loading Loading @@ -3203,17 +3203,10 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns) return 0; } static unsigned int mntns_inum(void *ns) { struct ns_common *p = ns; return p->inum; } const struct proc_ns_operations mntns_operations = { .name = "mnt", .type = CLONE_NEWNS, .get = mntns_get, .put = mntns_put, .install = mntns_install, .inum = mntns_inum, };
fs/proc/inode.c +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ static void proc_evict_inode(struct inode *inode) struct proc_dir_entry *de; struct ctl_table_header *head; const struct proc_ns_operations *ns_ops; void *ns; struct ns_common *ns; truncate_inode_pages_final(&inode->i_data); clear_inode(inode); Loading
fs/proc/namespaces.c +4 −4 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb, struct inode *inode; struct proc_inode *ei; struct qstr qname = { .name = "", }; void *ns; struct ns_common *ns; ns = ns_ops->get(task); if (!ns) Loading @@ -76,7 +76,7 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb, return ERR_PTR(-ENOMEM); } inode = iget_locked(sb, ns_ops->inum(ns)); inode = iget_locked(sb, ns->inum); if (!inode) { dput(dentry); ns_ops->put(ns); Loading Loading @@ -144,7 +144,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl struct proc_inode *ei = PROC_I(inode); const struct proc_ns_operations *ns_ops = ei->ns.ns_ops; struct task_struct *task; void *ns; struct ns_common *ns; char name[50]; int res = -EACCES; Loading @@ -160,7 +160,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl if (!ns) goto out_put_task; snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns_ops->inum(ns)); snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns->inum); res = readlink_copy(buffer, buflen, name); ns_ops->put(ns); out_put_task: Loading
include/linux/proc_ns.h +5 −5 Original line number Diff line number Diff line Loading @@ -6,18 +6,18 @@ struct pid_namespace; struct nsproxy; struct ns_common; struct proc_ns_operations { const char *name; int type; void *(*get)(struct task_struct *task); void (*put)(void *ns); int (*install)(struct nsproxy *nsproxy, void *ns); unsigned int (*inum)(void *ns); struct ns_common *(*get)(struct task_struct *task); void (*put)(struct ns_common *ns); int (*install)(struct nsproxy *nsproxy, struct ns_common *ns); }; struct proc_ns { void *ns; struct ns_common *ns; const struct proc_ns_operations *ns_ops; }; Loading
ipc/namespace.c +3 −9 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ static inline struct ipc_namespace *to_ipc_ns(struct ns_common *ns) return container_of(ns, struct ipc_namespace, ns); } static void *ipcns_get(struct task_struct *task) static struct ns_common *ipcns_get(struct task_struct *task) { struct ipc_namespace *ns = NULL; struct nsproxy *nsproxy; Loading @@ -168,12 +168,12 @@ static void *ipcns_get(struct task_struct *task) return ns ? &ns->ns : NULL; } static void ipcns_put(void *ns) static void ipcns_put(struct ns_common *ns) { return put_ipc_ns(to_ipc_ns(ns)); } static int ipcns_install(struct nsproxy *nsproxy, void *new) static int ipcns_install(struct nsproxy *nsproxy, struct ns_common *new) { struct ipc_namespace *ns = to_ipc_ns(new); if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || Loading @@ -187,16 +187,10 @@ static int ipcns_install(struct nsproxy *nsproxy, void *new) return 0; } static unsigned int ipcns_inum(void *vp) { return ((struct ns_common *)vp)->inum; } const struct proc_ns_operations ipcns_operations = { .name = "ipc", .type = CLONE_NEWIPC, .get = ipcns_get, .put = ipcns_put, .install = ipcns_install, .inum = ipcns_inum, };