lkml.org 
[lkml]   [2020]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@lst.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@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.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
\
 
 \ /
  Last update: 2020-08-06 16:33    [W:1.260 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site