[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200806141732.GA5902@lst.de>
Date: Thu, 6 Aug 2020 16:17:32 +0200
From: Christoph Hellwig <hch@....de>
To: Vikas Kumar <vikas.kumar2@....com>
Cc: Christoph Hellwig <hch@....de>, Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-api@...r.kernel.org, rafael@...nel.org
Subject: Re: [LTP-FAIL][02/21] fs: refactor ksys_umount
Fix for umount03 below. The other one works fine here, but from
your logs this might be a follow on if you run it after umount without
the fix.
---
>From 718c12b6559c6be5fac39837b496fd1cd325a0d5 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@....de>
Date: Thu, 6 Aug 2020 16:07:10 +0200
Subject: fs: fix a struct path leak in path_umount
Make sure we also put the dentry and vfsmnt in the illegal flags
and !may_mount cases.
Fixes: 41525f56e256 ("fs: refactor ksys_umount")
Reported-by: Vikas Kumar <vikas.kumar2@....com>
Signed-off-by: Christoph Hellwig <hch@....de>
---
fs/namespace.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index a7301790abb211..1180437dfab909 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1708,15 +1708,16 @@ static inline bool may_mandlock(void)
int path_umount(struct path *path, int flags)
{
- struct mount *mnt;
+ struct mount *mnt = real_mount(path->mnt);
int retval;
+ retval = -EINVAL;
if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))
- return -EINVAL;
+ goto dput_and_out;
+ retval = -EPERM;
if (!may_mount())
- return -EPERM;
+ goto dput_and_out;
- mnt = real_mount(path->mnt);
retval = -EINVAL;
if (path->dentry != path->mnt->mnt_root)
goto dput_and_out;
--
2.27.0
Powered by blists - more mailing lists