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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <675bef26.050a0220.1a2d0d.0004.GAE@google.com>
Date: Fri, 13 Dec 2024 00:24:06 -0800
From: syzbot <syzbot+8df514c431bd240c5644@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [ntfs3?] possible deadlock in
 mark_as_free_ex (2)

For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.

***

Subject: Re: [syzbot] [ntfs3?] possible deadlock in mark_as_free_ex (2)
Author: lizhi.xu@...driver.com

reset the lock order for openat

#syz test

diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c
index 6e86d6619..38ebd65f0 100644
--- a/fs/ntfs3/run.c
+++ b/fs/ntfs3/run.c
@@ -1096,9 +1096,17 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
 
 		/* Looks like volume is corrupted. */
 		ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
-
-		if (!down_write_trylock(&wnd->rw_lock))
+		struct rw_semaphore *lock =
+			is_mounted(sbi) ? &sbi->mft.ni->file.run_lock :
+					  NULL;
+		if (zone && lock)
+			down_read(lock);
+
+		if (!down_write_trylock(&wnd->rw_lock)) {
+			if (zone && lock)
+				up_read(lock);
 			continue;
+		}
 
 		if (zone) {
 			/*
@@ -1112,16 +1120,11 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
 		err = wnd_set_used_safe(wnd, lcn, len, &done);
 		if (zone) {
 			/* Restore zone. Lock mft run. */
-			struct rw_semaphore *lock =
-				is_mounted(sbi) ? &sbi->mft.ni->file.run_lock :
-						  NULL;
-			if (lock)
-				down_read(lock);
 			ntfs_refresh_zone(sbi);
-			if (lock)
-				up_read(lock);
 		}
 		up_write(&wnd->rw_lock);
+		if (zone && lock)
+			up_read(lock);
 		if (err)
 			return err;
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ