lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Jun 2023 21:37:14 +0800
From:   Li Dong <lidong@...o.com>
To:     Alexander Viro <viro@...iv.linux.org.uk>,
        Christian Brauner <brauner@...nel.org>,
        linux-fsdevel@...r.kernel.org (open list:FILESYSTEMS (VFS and
        infrastructure)), linux-kernel@...r.kernel.org (open list)
Cc:     opensource.kernel@...o.com, lidong@...o.com
Subject: [PATCH] fs: Fix bug in lock_rename_child that can cause deadlock

Function xx causes a deadlock,because s_vfs_rename_mutex was not released when return

Signed-off-by: Li Dong <lidong@...o.com>
---
 fs/namei.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index 91171da719c5..63b3fd05fef2 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3076,8 +3076,10 @@ struct dentry *lock_rename_child(struct dentry *c1, struct dentry *p2)
 	/*
 	 * nobody can move out of any directories on this fs.
 	 */
-	if (likely(c1->d_parent != p2))
+	if (likely(c1->d_parent != p2)) {
+		mutex_unlock(&c1->d_sb->s_vfs_rename_mutex);
 		return lock_two_directories(c1->d_parent, p2);
+	}
 
 	/*
 	 * c1 got moved into p2 while we were taking locks;
-- 
2.31.1.windows.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ