All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHES] stuff from the last cycle that missed the window
@ 2022-05-20  3:17 Al Viro
  2022-05-20  3:17 ` [PATCH] fs/namei.c:reserve_stack(): tidy up the call of try_to_unlazy() Al Viro
  2022-05-20  3:18 ` [PATCH] get rid of dead code in legitimize_root() Al Viro
  0 siblings, 2 replies; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:17 UTC (permalink / raw)
  To: linux-fsdevel

Several patches had been sitting in -next since January or so,
missed the last window.  Just noticed that this stuff had never
been posted to fsdevel, so...

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

* [PATCH] fs/namei.c:reserve_stack(): tidy up the call of try_to_unlazy()
  2022-05-20  3:17 [PATCHES] stuff from the last cycle that missed the window Al Viro
@ 2022-05-20  3:17 ` Al Viro
  2022-05-20 11:48   ` Christian Brauner
  2022-05-20  3:18 ` [PATCH] get rid of dead code in legitimize_root() Al Viro
  1 sibling, 1 reply; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:17 UTC (permalink / raw)
  To: linux-fsdevel

!foo() != 0 is a strange way to spell !foo(); fallout from
"fs: make unlazy_walk() error handling consistent"...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index b867a92c078e..2d6b94a950fe 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1754,7 +1754,7 @@ static int reserve_stack(struct nameidata *nd, struct path *link, unsigned seq)
 		// unlazy even if we fail to grab the link - cleanup needs it
 		bool grabbed_link = legitimize_path(nd, link, seq);
 
-		if (!try_to_unlazy(nd) != 0 || !grabbed_link)
+		if (!try_to_unlazy(nd) || !grabbed_link)
 			return -ECHILD;
 
 		if (nd_alloc_stack(nd))
-- 
2.30.2


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

* [PATCH] get rid of dead code in legitimize_root()
  2022-05-20  3:17 [PATCHES] stuff from the last cycle that missed the window Al Viro
  2022-05-20  3:17 ` [PATCH] fs/namei.c:reserve_stack(): tidy up the call of try_to_unlazy() Al Viro
@ 2022-05-20  3:18 ` Al Viro
  2022-05-20  3:20   ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Al Viro
  2022-05-20 11:43   ` [PATCH] get rid of dead code in legitimize_root() Christian Brauner
  1 sibling, 2 replies; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:18 UTC (permalink / raw)
  To: linux-fsdevel

Combination of LOOKUP_IS_SCOPED and NULL nd->root.mnt is impossible
after successful path_init().  All places where ->root.mnt might
become NULL do that only if LOOKUP_IS_SCOPED is not there and
path_init() itself can return success without setting nd->root
only if ND_ROOT_PRESET had been set (in which case nd->root
had been set by caller and never changed) or if the name had
been a relative one *and* none of the bits in LOOKUP_IS_SCOPED
had been present.

Since all calls of legitimize_root() must be downstream of successful
path_init(), the check for !nd->root.mnt && (nd->flags & LOOKUP_IS_SCOPED)
is pure paranoia.

FWIW, it had been discussed (and agreed upon) with Aleksa back when
scoped lookups had been merged; looks like that had fallen through the
cracks back then.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/namei.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 2d6b94a950fe..bfe4ec9e282b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -729,13 +729,6 @@ static bool legitimize_links(struct nameidata *nd)
 
 static bool legitimize_root(struct nameidata *nd)
 {
-	/*
-	 * For scoped-lookups (where nd->root has been zeroed), we need to
-	 * restart the whole lookup from scratch -- because set_root() is wrong
-	 * for these lookups (nd->dfd is the root, not the filesystem root).
-	 */
-	if (!nd->root.mnt && (nd->flags & LOOKUP_IS_SCOPED))
-		return false;
 	/* Nothing to do if nd->root is zero or is managed by the VFS user. */
 	if (!nd->root.mnt || (nd->state & ND_ROOT_PRESET))
 		return true;
-- 
2.30.2


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

* [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2)
  2022-05-20  3:18 ` [PATCH] get rid of dead code in legitimize_root() Al Viro
@ 2022-05-20  3:20   ` Al Viro
  2022-05-20  3:20     ` [PATCH] linux/mount.h: trim includes Al Viro
  2022-05-20 11:44     ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Christian Brauner
  2022-05-20 11:43   ` [PATCH] get rid of dead code in legitimize_root() Christian Brauner
  1 sibling, 2 replies; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:20 UTC (permalink / raw)
  To: linux-fsdevel

It's done once per (mount-related) syscall and there's no point
whatsoever making it inline.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/fsopen.c    | 4 ++--
 fs/internal.h  | 1 +
 fs/namespace.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/fsopen.c b/fs/fsopen.c
index 27a890aa493a..fc9d2d9fd234 100644
--- a/fs/fsopen.c
+++ b/fs/fsopen.c
@@ -119,7 +119,7 @@ SYSCALL_DEFINE2(fsopen, const char __user *, _fs_name, unsigned int, flags)
 	const char *fs_name;
 	int ret;
 
-	if (!ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN))
+	if (!may_mount())
 		return -EPERM;
 
 	if (flags & ~FSOPEN_CLOEXEC)
@@ -162,7 +162,7 @@ SYSCALL_DEFINE3(fspick, int, dfd, const char __user *, path, unsigned int, flags
 	unsigned int lookup_flags;
 	int ret;
 
-	if (!ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN))
+	if (!may_mount())
 		return -EPERM;
 
 	if ((flags & ~(FSPICK_CLOEXEC |
diff --git a/fs/internal.h b/fs/internal.h
index 8590c973c2f4..315ec2f419f7 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -84,6 +84,7 @@ extern int __mnt_want_write_file(struct file *);
 extern void __mnt_drop_write_file(struct file *);
 
 extern void dissolve_on_fput(struct vfsmount *);
+extern bool may_mount(void);
 
 int path_mount(const char *dev_name, struct path *path,
 		const char *type_page, unsigned long flags, void *data_page);
diff --git a/fs/namespace.c b/fs/namespace.c
index 40b994a29e90..6f91ce77e16b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1717,7 +1717,7 @@ void __detach_mounts(struct dentry *dentry)
 /*
  * Is the caller allowed to modify his namespace?
  */
-static inline bool may_mount(void)
+bool may_mount(void)
 {
 	return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN);
 }
-- 
2.30.2


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

* [PATCH] linux/mount.h: trim includes
  2022-05-20  3:20   ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Al Viro
@ 2022-05-20  3:20     ` Al Viro
  2022-05-20  3:22       ` [PATCH] m->mnt_root->d_inode->i_sb is a weird way to spell m->mnt_sb Al Viro
  2022-05-20 11:45       ` [PATCH] linux/mount.h: trim includes Christian Brauner
  2022-05-20 11:44     ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Christian Brauner
  1 sibling, 2 replies; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:20 UTC (permalink / raw)
  To: linux-fsdevel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 include/linux/mount.h | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/include/linux/mount.h b/include/linux/mount.h
index 7f18a7555dff..b3b149dcbf96 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -11,17 +11,15 @@
 #define _LINUX_MOUNT_H
 
 #include <linux/types.h>
-#include <linux/list.h>
-#include <linux/nodemask.h>
-#include <linux/spinlock.h>
-#include <linux/seqlock.h>
-#include <linux/atomic.h>
+#include <asm/barrier.h>
 
 struct super_block;
-struct vfsmount;
 struct dentry;
-struct mnt_namespace;
+struct user_namespace;
+struct file_system_type;
 struct fs_context;
+struct file;
+struct path;
 
 #define MNT_NOSUID	0x01
 #define MNT_NODEV	0x02
@@ -81,9 +79,6 @@ static inline struct user_namespace *mnt_user_ns(const struct vfsmount *mnt)
 	return smp_load_acquire(&mnt->mnt_userns);
 }
 
-struct file; /* forward dec */
-struct path;
-
 extern int mnt_want_write(struct vfsmount *mnt);
 extern int mnt_want_write_file(struct file *file);
 extern void mnt_drop_write(struct vfsmount *mnt);
@@ -94,12 +89,10 @@ extern struct vfsmount *mnt_clone_internal(const struct path *path);
 extern bool __mnt_is_readonly(struct vfsmount *mnt);
 extern bool mnt_may_suid(struct vfsmount *mnt);
 
-struct path;
 extern struct vfsmount *clone_private_mount(const struct path *path);
 extern int __mnt_want_write(struct vfsmount *);
 extern void __mnt_drop_write(struct vfsmount *);
 
-struct file_system_type;
 extern struct vfsmount *fc_mount(struct fs_context *fc);
 extern struct vfsmount *vfs_create_mount(struct fs_context *fc);
 extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
-- 
2.30.2


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

* [PATCH] m->mnt_root->d_inode->i_sb is a weird way to spell m->mnt_sb...
  2022-05-20  3:20     ` [PATCH] linux/mount.h: trim includes Al Viro
@ 2022-05-20  3:22       ` Al Viro
  2022-05-20  3:23         ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Al Viro
  2022-05-20 11:45       ` [PATCH] linux/mount.h: trim includes Christian Brauner
  1 sibling, 1 reply; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:22 UTC (permalink / raw)
  To: linux-fsdevel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/nfs/nfs4file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index e79ae4cbc395..6f5c61f4286e 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -326,7 +326,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
 	char *read_name = NULL;
 	int len, status = 0;
 
-	server = NFS_SERVER(ss_mnt->mnt_root->d_inode);
+	server = NFS_SB(ss_mnt->mnt_sb);
 
 	if (!fattr)
 		return ERR_PTR(-ENOMEM);
@@ -344,7 +344,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
 		goto out;
 	snprintf(read_name, len, SSC_READ_NAME_BODY, read_name_gen++);
 
-	r_ino = nfs_fhget(ss_mnt->mnt_root->d_inode->i_sb, src_fh, fattr);
+	r_ino = nfs_fhget(ss_mnt->mnt_sb, src_fh, fattr);
 	if (IS_ERR(r_ino)) {
 		res = ERR_CAST(r_ino);
 		goto out_free_name;
-- 
2.30.2


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

* [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount()
  2022-05-20  3:22       ` [PATCH] m->mnt_root->d_inode->i_sb is a weird way to spell m->mnt_sb Al Viro
@ 2022-05-20  3:23         ` Al Viro
  2022-05-20  3:23           ` [PATCH] move mount-related externs from fs.h to mount.h Al Viro
  2022-05-20 19:02           ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Eric W. Biederman
  0 siblings, 2 replies; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:23 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Eric Biederman

plain mntput() won't do.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 kernel/usermode_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/usermode_driver.c b/kernel/usermode_driver.c
index 9dae1f648713..8303f4c7ca71 100644
--- a/kernel/usermode_driver.c
+++ b/kernel/usermode_driver.c
@@ -28,7 +28,7 @@ static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *na
 
 	file = file_open_root_mnt(mnt, name, O_CREAT | O_WRONLY, 0700);
 	if (IS_ERR(file)) {
-		mntput(mnt);
+		kern_unmount(mnt);
 		return ERR_CAST(file);
 	}
 
@@ -38,7 +38,7 @@ static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *na
 		if (err >= 0)
 			err = -ENOMEM;
 		filp_close(file, NULL);
-		mntput(mnt);
+		kern_unmount(mnt);
 		return ERR_PTR(err);
 	}
 
-- 
2.30.2


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

* [PATCH] move mount-related externs from fs.h to mount.h
  2022-05-20  3:23         ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Al Viro
@ 2022-05-20  3:23           ` Al Viro
  2022-05-20 11:54             ` Christian Brauner
  2022-05-20 19:02           ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Eric W. Biederman
  1 sibling, 1 reply; 14+ messages in thread
From: Al Viro @ 2022-05-20  3:23 UTC (permalink / raw)
  To: linux-fsdevel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/alpha/kernel/osf_sys.c |  1 +
 include/linux/fs.h          | 11 -----------
 include/linux/mount.h       | 12 ++++++++++++
 security/smack/smackfs.c    |  1 +
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 8bbeebb73cf0..d257293401e2 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -36,6 +36,7 @@
 #include <linux/types.h>
 #include <linux/ipc.h>
 #include <linux/namei.h>
+#include <linux/mount.h>
 #include <linux/uio.h>
 #include <linux/vfs.h>
 #include <linux/rcupdate.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f3daaea16554..b51e3bd223f6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2504,22 +2504,11 @@ struct super_block *sget(struct file_system_type *type,
 
 extern int register_filesystem(struct file_system_type *);
 extern int unregister_filesystem(struct file_system_type *);
-extern struct vfsmount *kern_mount(struct file_system_type *);
-extern void kern_unmount(struct vfsmount *mnt);
-extern int may_umount_tree(struct vfsmount *);
-extern int may_umount(struct vfsmount *);
-extern long do_mount(const char *, const char __user *,
-		     const char *, unsigned long, void *);
-extern struct vfsmount *collect_mounts(const struct path *);
-extern void drop_collected_mounts(struct vfsmount *);
-extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
-			  struct vfsmount *);
 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 freeze_super(struct super_block *super);
 extern int thaw_super(struct super_block *super);
-extern bool our_mnt(struct vfsmount *mnt);
 extern __printf(2, 3)
 int super_setup_bdi_name(struct super_block *sb, char *fmt, ...);
 extern int super_setup_bdi(struct super_block *sb);
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b3b149dcbf96..55a4abaf6715 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -108,6 +108,18 @@ extern void mark_mounts_for_expiry(struct list_head *mounts);
 extern dev_t name_to_dev_t(const char *name);
 extern bool path_is_mountpoint(const struct path *path);
 
+extern bool our_mnt(struct vfsmount *mnt);
+
+extern struct vfsmount *kern_mount(struct file_system_type *);
+extern void kern_unmount(struct vfsmount *mnt);
+extern int may_umount_tree(struct vfsmount *);
+extern int may_umount(struct vfsmount *);
+extern long do_mount(const char *, const char __user *,
+		     const char *, unsigned long, void *);
+extern struct vfsmount *collect_mounts(const struct path *);
+extern void drop_collected_mounts(struct vfsmount *);
+extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
+			  struct vfsmount *);
 extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num);
 
 #endif /* _LINUX_MOUNT_H */
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 658eab05599e..192f33cc601e 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -23,6 +23,7 @@
 #include <linux/ctype.h>
 #include <linux/audit.h>
 #include <linux/magic.h>
+#include <linux/mount.h>
 #include <linux/fs_context.h>
 #include "smack.h"
 
-- 
2.30.2


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

* Re: [PATCH] get rid of dead code in legitimize_root()
  2022-05-20  3:18 ` [PATCH] get rid of dead code in legitimize_root() Al Viro
  2022-05-20  3:20   ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Al Viro
@ 2022-05-20 11:43   ` Christian Brauner
  1 sibling, 0 replies; 14+ messages in thread
From: Christian Brauner @ 2022-05-20 11:43 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

On Fri, May 20, 2022 at 03:18:32AM +0000, Al Viro wrote:
> Combination of LOOKUP_IS_SCOPED and NULL nd->root.mnt is impossible
> after successful path_init().  All places where ->root.mnt might
> become NULL do that only if LOOKUP_IS_SCOPED is not there and
> path_init() itself can return success without setting nd->root
> only if ND_ROOT_PRESET had been set (in which case nd->root
> had been set by caller and never changed) or if the name had
> been a relative one *and* none of the bits in LOOKUP_IS_SCOPED
> had been present.
> 
> Since all calls of legitimize_root() must be downstream of successful
> path_init(), the check for !nd->root.mnt && (nd->flags & LOOKUP_IS_SCOPED)
> is pure paranoia.
> 
> FWIW, it had been discussed (and agreed upon) with Aleksa back when
> scoped lookups had been merged; looks like that had fallen through the
> cracks back then.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

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

* Re: [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2)
  2022-05-20  3:20   ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Al Viro
  2022-05-20  3:20     ` [PATCH] linux/mount.h: trim includes Al Viro
@ 2022-05-20 11:44     ` Christian Brauner
  1 sibling, 0 replies; 14+ messages in thread
From: Christian Brauner @ 2022-05-20 11:44 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

On Fri, May 20, 2022 at 03:20:06AM +0000, Al Viro wrote:
> It's done once per (mount-related) syscall and there's no point
> whatsoever making it inline.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

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

* Re: [PATCH] linux/mount.h: trim includes
  2022-05-20  3:20     ` [PATCH] linux/mount.h: trim includes Al Viro
  2022-05-20  3:22       ` [PATCH] m->mnt_root->d_inode->i_sb is a weird way to spell m->mnt_sb Al Viro
@ 2022-05-20 11:45       ` Christian Brauner
  1 sibling, 0 replies; 14+ messages in thread
From: Christian Brauner @ 2022-05-20 11:45 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

On Fri, May 20, 2022 at 03:20:45AM +0000, Al Viro wrote:
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

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

* Re: [PATCH] fs/namei.c:reserve_stack(): tidy up the call of try_to_unlazy()
  2022-05-20  3:17 ` [PATCH] fs/namei.c:reserve_stack(): tidy up the call of try_to_unlazy() Al Viro
@ 2022-05-20 11:48   ` Christian Brauner
  0 siblings, 0 replies; 14+ messages in thread
From: Christian Brauner @ 2022-05-20 11:48 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

On Fri, May 20, 2022 at 03:17:52AM +0000, Al Viro wrote:
> !foo() != 0 is a strange way to spell !foo(); fallout from
> "fs: make unlazy_walk() error handling consistent"...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

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

* Re: [PATCH] move mount-related externs from fs.h to mount.h
  2022-05-20  3:23           ` [PATCH] move mount-related externs from fs.h to mount.h Al Viro
@ 2022-05-20 11:54             ` Christian Brauner
  0 siblings, 0 replies; 14+ messages in thread
From: Christian Brauner @ 2022-05-20 11:54 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

On Fri, May 20, 2022 at 03:23:58AM +0000, Al Viro wrote:
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

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

* Re: [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount()
  2022-05-20  3:23         ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Al Viro
  2022-05-20  3:23           ` [PATCH] move mount-related externs from fs.h to mount.h Al Viro
@ 2022-05-20 19:02           ` Eric W. Biederman
  1 sibling, 0 replies; 14+ messages in thread
From: Eric W. Biederman @ 2022-05-20 19:02 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

Al Viro <viro@zeniv.linux.org.uk> writes:

> plain mntput() won't do.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>

It is already performing kern_unmount on the happy path
so I don't see how it will be a problem to call kern_unmount
on a failure path.

Do you want to merge this through your tree?

>  kernel/usermode_driver.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/usermode_driver.c b/kernel/usermode_driver.c
> index 9dae1f648713..8303f4c7ca71 100644
> --- a/kernel/usermode_driver.c
> +++ b/kernel/usermode_driver.c
> @@ -28,7 +28,7 @@ static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *na
>  
>  	file = file_open_root_mnt(mnt, name, O_CREAT | O_WRONLY, 0700);
>  	if (IS_ERR(file)) {
> -		mntput(mnt);
> +		kern_unmount(mnt);
>  		return ERR_CAST(file);
>  	}
>  
> @@ -38,7 +38,7 @@ static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *na
>  		if (err >= 0)
>  			err = -ENOMEM;
>  		filp_close(file, NULL);
> -		mntput(mnt);
> +		kern_unmount(mnt);
>  		return ERR_PTR(err);
>  	}

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

end of thread, other threads:[~2022-05-20 19:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  3:17 [PATCHES] stuff from the last cycle that missed the window Al Viro
2022-05-20  3:17 ` [PATCH] fs/namei.c:reserve_stack(): tidy up the call of try_to_unlazy() Al Viro
2022-05-20 11:48   ` Christian Brauner
2022-05-20  3:18 ` [PATCH] get rid of dead code in legitimize_root() Al Viro
2022-05-20  3:20   ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Al Viro
2022-05-20  3:20     ` [PATCH] linux/mount.h: trim includes Al Viro
2022-05-20  3:22       ` [PATCH] m->mnt_root->d_inode->i_sb is a weird way to spell m->mnt_sb Al Viro
2022-05-20  3:23         ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Al Viro
2022-05-20  3:23           ` [PATCH] move mount-related externs from fs.h to mount.h Al Viro
2022-05-20 11:54             ` Christian Brauner
2022-05-20 19:02           ` [PATCH] blob_to_mnt(): kern_unmount() is needed to undo kern_mount() Eric W. Biederman
2022-05-20 11:45       ` [PATCH] linux/mount.h: trim includes Christian Brauner
2022-05-20 11:44     ` [PATCH] uninline may_mount() and don't opencode it in fspick(2)/fsopen(2) Christian Brauner
2022-05-20 11:43   ` [PATCH] get rid of dead code in legitimize_root() Christian Brauner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.