linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* vfs: Fixes/adjustments for mount API stuff
@ 2018-08-21  9:54 David Howells
  2018-08-21  9:55 ` [PATCH 1/6] vfs: Fix vfs_dup_fs_context() David Howells
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:54 UTC (permalink / raw)
  To: viro; +Cc: Andrei Vagin, dhowells, linux-fsdevel, linux-kernel


Hi Al,

Can you add these patches to the mount API stuff?

There are some fixes and some adjustments to the code.

The patches can also be found here:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=mount-api-2

Thanks,
David
---
Andrei Vagin (1):
      proc: Set correct userns for new proc super created by a new pid_namespace

David Howells (5):
      vfs: Fix vfs_dup_fs_context()
      vfs: Fix fs_context logging when there's no log
      afs: Move the source fs parameter to the first position
      vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo
      vfs: Adjust fsinfo sample output


 fs/afs/super.c              |   29 +++++++++++++++--------------
 fs/fs_context.c             |    4 ++--
 fs/hugetlbfs/inode.c        |    7 ++++---
 fs/kernfs/mount.c           |    8 ++++----
 fs/proc/root.c              |    5 +++++
 fs/statfs.c                 |   15 ++++++++-------
 include/linux/fs.h          |    4 ++--
 include/linux/fsinfo.h      |    2 +-
 samples/statx/test-fsinfo.c |   30 ++++++++++++++++++++++++++++++
 9 files changed, 71 insertions(+), 33 deletions(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] vfs: Fix vfs_dup_fs_context()
  2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
@ 2018-08-21  9:55 ` David Howells
  2018-08-21  9:55 ` [PATCH 2/6] vfs: Fix fs_context logging when there's no log David Howells
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:55 UTC (permalink / raw)
  To: viro; +Cc: dhowells, linux-fsdevel, linux-kernel

vfs_dup_fs_context() allocates the wrong type of structure and as a result
ends up with one that's too small.

This isn't a problem at this time as nothing uses vfs_dup_fs_context() yet
(until nfs and btrfs conversions come along).

Fixes: ad3e21240b41 ("vfs: Implement a filesystem superblock creation/configuration context")
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/fs_context.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs_context.c b/fs/fs_context.c
index a6597a2fbf2b..14921b2c1e42 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -348,7 +348,7 @@ struct fs_context *vfs_dup_fs_context(struct fs_context *src_fc)
 	if (!src_fc->ops->dup)
 		return ERR_PTR(-EOPNOTSUPP);
 
-	fc = kmemdup(src_fc, sizeof(struct legacy_fs_context), GFP_KERNEL);
+	fc = kmemdup(src_fc, sizeof(struct fs_context), GFP_KERNEL);
 	if (!fc)
 		return ERR_PTR(-ENOMEM);
 


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] vfs: Fix fs_context logging when there's no log
  2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
  2018-08-21  9:55 ` [PATCH 1/6] vfs: Fix vfs_dup_fs_context() David Howells
@ 2018-08-21  9:55 ` David Howells
  2018-08-21  9:55 ` [PATCH 3/6] afs: Move the source fs parameter to the first position David Howells
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:55 UTC (permalink / raw)
  To: viro; +Cc: dhowells, linux-fsdevel, linux-kernel

If an fs_context-based mount is called from mount(2) or some other place
that doesn't set up the logging-through-fd, then under some circumstances
an oops will occur due to the log being unconditionally accessed in
logfc().

Fix this by checking whether there is a log structure before attempting to
access it

Fixes: 06b830edff9f ("vfs: Implement logging through fs_context")
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/fs_context.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs_context.c b/fs/fs_context.c
index 14921b2c1e42..053b8d0f11ea 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -416,7 +416,7 @@ void logfc(struct fs_context *fc, const char *fmt, ...)
 	if ((unsigned long)p >= (unsigned long)__start_rodata &&
 	    (unsigned long)p <  (unsigned long)__end_rodata)
 		goto const_string;
-	if (within_module_core((unsigned long)p, log->owner))
+	if (log && within_module_core((unsigned long)p, log->owner))
 		goto const_string;
 	q = kstrdup(p, GFP_KERNEL);
 	goto copied_string;


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] afs: Move the source fs parameter to the first position
  2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
  2018-08-21  9:55 ` [PATCH 1/6] vfs: Fix vfs_dup_fs_context() David Howells
  2018-08-21  9:55 ` [PATCH 2/6] vfs: Fix fs_context logging when there's no log David Howells
@ 2018-08-21  9:55 ` David Howells
  2018-08-21  9:55 ` [PATCH 4/6] vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo David Howells
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:55 UTC (permalink / raw)
  To: viro; +Cc: dhowells, linux-fsdevel, linux-kernel

Move the source fs parameter to the first position in the parameter list,
numerically speaking.  Note that it isn't moved in the key string table as
that's a sorted list.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/super.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index 7c97836e7937..15c5eb9412bb 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -68,16 +68,16 @@ static struct kmem_cache *afs_inode_cachep;
 static atomic_t afs_count_active_inodes;
 
 enum afs_param {
+	Opt_source,
 	Opt_autocell,
 	Opt_dyn,
-	Opt_source,
 	nr__afs_params
 };
 
 static const struct fs_parameter_spec afs_param_specs[nr__afs_params] = {
+	[Opt_source]	= { fs_param_is_string },
 	[Opt_autocell]	= { fs_param_takes_no_value },
 	[Opt_dyn]	= { fs_param_takes_no_value },
-	[Opt_source]	= { fs_param_is_string },
 };
 
 static const struct constant_table afs_param_keys[] = {
@@ -900,14 +900,6 @@ static int afs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
 		if (params->Mth)
 			return -ENODATA;
 		switch (params->Nth) {
-		case Opt_autocell:
-			if (as->autocell)
-				str = "autocell";
-			goto string;
-		case Opt_dyn:
-			if (dyn_root)
-				str = "dyn";
-			goto string;
 		case Opt_source:
 			if (dyn_root)
 				return 0;
@@ -918,6 +910,14 @@ static int afs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
 				       volume->type == AFSVL_RWVOL ? "" :
 				       volume->type == AFSVL_ROVOL ? ".readonly" :
 				       ".backup");
+		case Opt_autocell:
+			if (as->autocell)
+				str = "autocell";
+			goto string;
+		case Opt_dyn:
+			if (dyn_root)
+				str = "dyn";
+			goto string;
 		default:
 			return -ENODATA;
 		}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo
  2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
                   ` (2 preceding siblings ...)
  2018-08-21  9:55 ` [PATCH 3/6] afs: Move the source fs parameter to the first position David Howells
@ 2018-08-21  9:55 ` David Howells
  2018-08-21  9:55 ` [PATCH 5/6] vfs: Adjust fsinfo sample output David Howells
  2018-08-21  9:55 ` [PATCH 6/6] proc: Set correct userns for new proc super created by a new pid_namespace David Howells
  5 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:55 UTC (permalink / raw)
  To: viro; +Cc: dhowells, linux-fsdevel, linux-kernel

Pass the path, not just the dentry, into the superblock get_fsinfo
operation because s->s_root isn't useful on NFS for retrocalculating the
source name, but rather mnt->mnt_root must be used.

Further, rename the ->get_fsinfo() superblock op to ->fsinfo() for
consistency.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/super.c         |    9 +++++----
 fs/hugetlbfs/inode.c   |    7 ++++---
 fs/kernfs/mount.c      |    8 ++++----
 fs/statfs.c            |   15 ++++++++-------
 include/linux/fs.h     |    4 ++--
 include/linux/fsinfo.h |    2 +-
 6 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index 15c5eb9412bb..0afff582eb99 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -35,7 +35,7 @@ static void afs_kill_super(struct super_block *sb);
 static struct inode *afs_alloc_inode(struct super_block *sb);
 static void afs_destroy_inode(struct inode *inode);
 static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
-static int afs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params);
+static int afs_fsinfo(struct path *path, struct fsinfo_kparams *params);
 static int afs_show_devname(struct seq_file *m, struct dentry *root);
 static int afs_show_options(struct seq_file *m, struct dentry *root);
 static int afs_init_fs_context(struct fs_context *fc, struct dentry *reference);
@@ -55,7 +55,7 @@ int afs_net_id;
 
 static const struct super_operations afs_super_ops = {
 	.statfs		= afs_statfs,
-	.get_fsinfo	= afs_get_fsinfo,
+	.fsinfo		= afs_fsinfo,
 	.alloc_inode	= afs_alloc_inode,
 	.drop_inode	= afs_drop_inode,
 	.destroy_inode	= afs_destroy_inode,
@@ -778,12 +778,13 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
 /*
  * Get filesystem information.
  */
-static int afs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
+static int afs_fsinfo(struct path *path, struct fsinfo_kparams *params)
 {
 	struct fsinfo_timestamp_info *tsinfo;
 	struct fsinfo_server_address *addr;
 	struct fsinfo_capabilities *caps;
 	struct fsinfo_supports *sup;
+	struct dentry *dentry = path->dentry;
 	struct afs_server_list *slist;
 	struct afs_super_info *as = AFS_FS_S(dentry->d_sb);
 	struct afs_addr_list *alist;
@@ -923,7 +924,7 @@ static int afs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
 		}
 
 	default:
-		return generic_fsinfo(dentry, params);
+		return generic_fsinfo(path, params);
 	}
 
 string:
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index e2378c8ce7e0..e4f7619e9541 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -949,8 +949,9 @@ static int hugetlbfs_show_options(struct seq_file *m, struct dentry *root)
 	return 0;
 }
 
-static int hugetlbfs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
+static int hugetlbfs_fsinfo(struct path *path, struct fsinfo_kparams *params)
 {
+	struct dentry *dentry = path->dentry;
 	struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb);
 	struct hugepage_subpool *spool = sbinfo->spool;
 	unsigned long hpage_size = huge_page_size(sbinfo->hstate);
@@ -1008,7 +1009,7 @@ static int hugetlbfs_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *pa
 			return -ENODATA;
 		}
 	default:
-		return generic_fsinfo(dentry, params);
+		return generic_fsinfo(path, params);
 	}
 }
 
@@ -1171,7 +1172,7 @@ static const struct super_operations hugetlbfs_ops = {
 	.statfs		= hugetlbfs_statfs,
 	.put_super	= hugetlbfs_put_super,
 	.show_options	= hugetlbfs_show_options,
-	.get_fsinfo	= hugetlbfs_get_fsinfo,
+	.fsinfo		= hugetlbfs_fsinfo,
 };
 
 /*
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index b568e6c5e063..6194ad7a817c 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -56,9 +56,9 @@ static int kernfs_sop_show_path(struct seq_file *sf, struct dentry *dentry)
 	return 0;
 }
 
-static int kernfs_sop_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
+static int kernfs_sop_fsinfo(struct path *path, struct fsinfo_kparams *params)
 {
-	struct kernfs_root *root = kernfs_root(kernfs_dentry_node(dentry));
+	struct kernfs_root *root = kernfs_root(kernfs_dentry_node(path->dentry));
 	struct kernfs_syscall_ops *scops = root->syscall_ops;
 	int ret;
 
@@ -67,7 +67,7 @@ static int kernfs_sop_get_fsinfo(struct dentry *dentry, struct fsinfo_kparams *p
 		if (ret != -EAGAIN)
 			return ret;
 	}
-	return generic_fsinfo(dentry, params);
+	return generic_fsinfo(path, params);
 }
 
 const struct super_operations kernfs_sops = {
@@ -78,7 +78,7 @@ const struct super_operations kernfs_sops = {
 	.reconfigure	= kernfs_sop_reconfigure,
 	.show_options	= kernfs_sop_show_options,
 	.show_path	= kernfs_sop_show_path,
-	.get_fsinfo	= kernfs_sop_get_fsinfo,
+	.fsinfo		= kernfs_sop_fsinfo,
 };
 
 /*
diff --git a/fs/statfs.c b/fs/statfs.c
index 6bb95808ee66..95fdfd9a79d1 100644
--- a/fs/statfs.c
+++ b/fs/statfs.c
@@ -627,8 +627,9 @@ static int fsinfo_generic_param_enum(struct file_system_type *f,
 /*
  * Implement some queries generically from stuff in the superblock.
  */
-int generic_fsinfo(struct dentry *dentry, struct fsinfo_kparams *params)
+int generic_fsinfo(struct path *path, struct fsinfo_kparams *params)
 {
+	struct dentry *dentry = path->dentry;
 	struct file_system_type *f = dentry->d_sb->s_type;
 	
 #define _gen(X, Y) FSINFO_ATTR_##X: return fsinfo_generic_##Y(dentry, params->buffer)
@@ -659,10 +660,10 @@ EXPORT_SYMBOL(generic_fsinfo);
  * Retrieve the filesystem info.  We make some stuff up if the operation is not
  * supported.
  */
-int vfs_fsinfo(const struct path *path, struct fsinfo_kparams *params)
+int vfs_fsinfo(struct path *path, struct fsinfo_kparams *params)
 {
 	struct dentry *dentry = path->dentry;
-	int (*get_fsinfo)(struct dentry *, struct fsinfo_kparams *);
+	int (*fsinfo)(struct path *, struct fsinfo_kparams *);
 	int ret;
 
 	if (params->request == FSINFO_ATTR_FSINFO) {
@@ -673,18 +674,18 @@ int vfs_fsinfo(const struct path *path, struct fsinfo_kparams *params)
 		return sizeof(*info);
 	}
 
-	get_fsinfo = dentry->d_sb->s_op->get_fsinfo;
-	if (!get_fsinfo) {
+	fsinfo = dentry->d_sb->s_op->fsinfo;
+	if (!fsinfo) {
 		if (!dentry->d_sb->s_op->statfs)
 			return -EOPNOTSUPP;
-		get_fsinfo = generic_fsinfo;
+		fsinfo = generic_fsinfo;
 	}
 
 	ret = security_sb_statfs(dentry);
 	if (ret)
 		return ret;
 
-	ret = get_fsinfo(dentry, params);
+	ret = fsinfo(path, params);
 	if (ret < 0)
 		return ret;
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 053d53861995..b9b5ba36033c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1851,7 +1851,7 @@ struct super_operations {
 	int (*thaw_super) (struct super_block *);
 	int (*unfreeze_fs) (struct super_block *);
 	int (*statfs) (struct dentry *, struct kstatfs *);
-	int (*get_fsinfo) (struct dentry *, struct fsinfo_kparams *);
+	int (*fsinfo) (struct path *, struct fsinfo_kparams *);
 	int (*remount_fs) (struct super_block *, int *, char *, size_t);
 	int (*reconfigure) (struct super_block *, struct fs_context *);
 	void (*umount_begin) (struct super_block *);
@@ -2229,7 +2229,7 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
 extern int vfs_statfs(const struct path *, struct kstatfs *);
 extern int user_statfs(const char __user *, struct kstatfs *);
 extern int fd_statfs(int, struct kstatfs *);
-extern int vfs_fsinfo(const struct path *, struct fsinfo_kparams *);
+extern int vfs_fsinfo(struct path *, struct fsinfo_kparams *);
 extern int freeze_super(struct super_block *super);
 extern int thaw_super(struct super_block *super);
 extern bool our_mnt(struct vfsmount *mnt);
diff --git a/include/linux/fsinfo.h b/include/linux/fsinfo.h
index f2d25b898d48..e488701c5c04 100644
--- a/include/linux/fsinfo.h
+++ b/include/linux/fsinfo.h
@@ -24,7 +24,7 @@ struct fsinfo_kparams {
 	size_t			buf_size;	/* Size of the buffer */
 };
 
-extern int generic_fsinfo(struct dentry *, struct fsinfo_kparams *);
+extern int generic_fsinfo(struct path *, struct fsinfo_kparams *);
 
 static inline void fsinfo_set_cap(struct fsinfo_capabilities *c,
 				  enum fsinfo_capability cap)


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] vfs: Adjust fsinfo sample output
  2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
                   ` (3 preceding siblings ...)
  2018-08-21  9:55 ` [PATCH 4/6] vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo David Howells
@ 2018-08-21  9:55 ` David Howells
  2018-08-21  9:55 ` [PATCH 6/6] proc: Set correct userns for new proc super created by a new pid_namespace David Howells
  5 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:55 UTC (permalink / raw)
  To: viro; +Cc: dhowells, linux-fsdevel, linux-kernel

Adjust the output of the test-fsinfo sample program to:

 (1) Print server addresses if of AF_INET or AF_INET6 family.

 (2) Not print parameter descriptions (the test-fs-query sample program can
     be used for that).

 (3) Only print non-blank parameter values so that parameters that just
     encode defaults don't clutter up the output.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 samples/statx/test-fsinfo.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/samples/statx/test-fsinfo.c b/samples/statx/test-fsinfo.c
index 21714ef7ef5b..c08978acf08b 100644
--- a/samples/statx/test-fsinfo.c
+++ b/samples/statx/test-fsinfo.c
@@ -26,6 +26,7 @@
 #include <linux/fsinfo.h>
 #include <linux/socket.h>
 #include <sys/stat.h>
+#include <arpa/inet.h>
 
 static bool debug = 0;
 
@@ -304,6 +305,24 @@ static void dump_attr_VOLUME_UUID(union reply *r, int size)
 static void dump_attr_SERVER_ADDRESS(union reply *r, int size)
 {
 	struct fsinfo_server_address *f = &r->srv_addr;
+	struct sockaddr_in6 *sin6;
+	struct sockaddr_in *sin;
+	char buf[1024];
+
+	switch (f->address.ss_family) {
+	case AF_INET:
+		sin = (struct sockaddr_in *)&f->address;
+		if (!inet_ntop(AF_INET, &sin->sin_addr, buf, sizeof(buf)))
+			break;
+		printf("IPv4: %s\n", buf);
+		return;
+	case AF_INET6:
+		sin6 = (struct sockaddr_in6 *)&f->address;
+		if (!inet_ntop(AF_INET6, &sin6->sin6_addr, buf, sizeof(buf)))
+			break;
+		printf("IPv6: %s\n", buf);
+		return;
+	}
 
 	printf("family=%u\n", f->address.ss_family);
 }
@@ -426,6 +445,17 @@ static int try_one(const char *file, struct fsinfo_params *params, bool raw)
 		return 0;
 	}
 
+	switch (params->request) {
+	case FSINFO_ATTR_PARAM_DESCRIPTION:
+	case FSINFO_ATTR_PARAM_SPECIFICATION:
+	case FSINFO_ATTR_PARAM_NAME:
+	case FSINFO_ATTR_PARAM_ENUM:
+		return 0;
+	case FSINFO_ATTR_PARAMETER:
+		if (ret == 0)
+			return 0;
+	}
+
 	switch (about & 0xc000) {
 	case 0x0000:
 		printf("\e[33m%s\e[m: ",


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] proc: Set correct userns for new proc super created by a new pid_namespace
  2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
                   ` (4 preceding siblings ...)
  2018-08-21  9:55 ` [PATCH 5/6] vfs: Adjust fsinfo sample output David Howells
@ 2018-08-21  9:55 ` David Howells
  5 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2018-08-21  9:55 UTC (permalink / raw)
  To: viro; +Cc: Andrei Vagin, dhowells, linux-fsdevel, linux-kernel

From: Andrei Vagin <avagin@openvz.org>

Fix the setting up a new proc superblock for a new pid_namespace such that
the user_ns for that proc superblock needs to be taken from the new
pid_namespace and not the active process.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/proc/root.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/proc/root.c b/fs/proc/root.c
index 1d6e5bfa30cc..1419b48a89ab 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -315,6 +315,11 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
 	if (IS_ERR(fc))
 		return PTR_ERR(fc);
 
+	if (fc->user_ns != ns->user_ns) {
+		put_user_ns(fc->user_ns);
+		fc->user_ns = get_user_ns(ns->user_ns);
+	}
+
 	ctx = fc->fs_private;
 	if (ctx->pid_ns != ns) {
 		put_pid_ns(ctx->pid_ns);


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-21  9:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
2018-08-21  9:55 ` [PATCH 1/6] vfs: Fix vfs_dup_fs_context() David Howells
2018-08-21  9:55 ` [PATCH 2/6] vfs: Fix fs_context logging when there's no log David Howells
2018-08-21  9:55 ` [PATCH 3/6] afs: Move the source fs parameter to the first position David Howells
2018-08-21  9:55 ` [PATCH 4/6] vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo David Howells
2018-08-21  9:55 ` [PATCH 5/6] vfs: Adjust fsinfo sample output David Howells
2018-08-21  9:55 ` [PATCH 6/6] proc: Set correct userns for new proc super created by a new pid_namespace David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).