Loading fs/nsfs.c +0 −18 Original line number Diff line number Diff line Loading @@ -235,24 +235,6 @@ bool proc_ns_file(const struct file *file) return file->f_op == &ns_file_operations; } struct file *proc_ns_fget(int fd) { struct file *file; file = fget(fd); if (!file) return ERR_PTR(-EBADF); if (file->f_op != &ns_file_operations) goto out_invalid; return file; out_invalid: fput(file); return ERR_PTR(-EINVAL); } /** * ns_match() - Returns true if current namespace matches dev/ino provided. * @ns: current namespace Loading include/linux/proc_ns.h +0 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ static inline int ns_alloc_inum(struct ns_common *ns) #define ns_free_inum(ns) proc_free_inum((ns)->inum) extern struct file *proc_ns_fget(int fd); #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private) extern int ns_get_path(struct path *path, struct task_struct *task, const struct proc_ns_operations *ns_ops); Loading net/core/net_namespace.c +11 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <linux/sched/task.h> #include <linux/uidgid.h> #include <linux/cookie.h> #include <linux/proc_fs.h> #include <net/sock.h> #include <net/netlink.h> Loading Loading @@ -676,21 +677,19 @@ EXPORT_SYMBOL_GPL(get_net_ns); struct net *get_net_ns_by_fd(int fd) { struct file *file; struct ns_common *ns; struct net *net; struct fd f = fdget(fd); struct net *net = ERR_PTR(-EINVAL); file = proc_ns_fget(fd); if (IS_ERR(file)) return ERR_CAST(file); if (!f.file) return ERR_PTR(-EBADF); ns = get_proc_ns(file_inode(file)); if (proc_ns_file(f.file)) { struct ns_common *ns = get_proc_ns(file_inode(f.file)); if (ns->ops == &netns_operations) net = get_net(container_of(ns, struct net, ns)); else net = ERR_PTR(-EINVAL); } fdput(f); fput(file); return net; } EXPORT_SYMBOL_GPL(get_net_ns_by_fd); Loading Loading
fs/nsfs.c +0 −18 Original line number Diff line number Diff line Loading @@ -235,24 +235,6 @@ bool proc_ns_file(const struct file *file) return file->f_op == &ns_file_operations; } struct file *proc_ns_fget(int fd) { struct file *file; file = fget(fd); if (!file) return ERR_PTR(-EBADF); if (file->f_op != &ns_file_operations) goto out_invalid; return file; out_invalid: fput(file); return ERR_PTR(-EINVAL); } /** * ns_match() - Returns true if current namespace matches dev/ino provided. * @ns: current namespace Loading
include/linux/proc_ns.h +0 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ static inline int ns_alloc_inum(struct ns_common *ns) #define ns_free_inum(ns) proc_free_inum((ns)->inum) extern struct file *proc_ns_fget(int fd); #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private) extern int ns_get_path(struct path *path, struct task_struct *task, const struct proc_ns_operations *ns_ops); Loading
net/core/net_namespace.c +11 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <linux/sched/task.h> #include <linux/uidgid.h> #include <linux/cookie.h> #include <linux/proc_fs.h> #include <net/sock.h> #include <net/netlink.h> Loading Loading @@ -676,21 +677,19 @@ EXPORT_SYMBOL_GPL(get_net_ns); struct net *get_net_ns_by_fd(int fd) { struct file *file; struct ns_common *ns; struct net *net; struct fd f = fdget(fd); struct net *net = ERR_PTR(-EINVAL); file = proc_ns_fget(fd); if (IS_ERR(file)) return ERR_CAST(file); if (!f.file) return ERR_PTR(-EBADF); ns = get_proc_ns(file_inode(file)); if (proc_ns_file(f.file)) { struct ns_common *ns = get_proc_ns(file_inode(f.file)); if (ns->ops == &netns_operations) net = get_net(container_of(ns, struct net, ns)); else net = ERR_PTR(-EINVAL); } fdput(f); fput(file); return net; } EXPORT_SYMBOL_GPL(get_net_ns_by_fd); Loading