[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175573318818.4130038.7207560675429333657.stgit@frogsfrogsfrogs>
Date: Wed, 20 Aug 2025 16:44:00 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 12/12] libext2fs: relock CACHE_MTX after calling ->write_error
From: Darrick J. Wong <djwong@...nel.org>
In the UNIX I/O manager, we drop CACHE_MTX before calling the
->write_error handler in case it decides to retry the failed write.
Therefore, we must retake the lock after it returns, to ensure
consistent lock state when flush_cached_blocks returns.
Cc: <linux-ext4@...r.kernel.org> # v1.46.6
Fixes: 0e0c7537eb5fdc ("libext2fs: unix_io: fix_potential error path deadlock in flush_cached_blocks()")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
lib/ext2fs/unix_io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 1af246da345bca..cb408f51779aa7 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -734,6 +734,7 @@ static errcode_t flush_cached_blocks(io_channel channel,
retval2);
if (err_buf)
ext2fs_free_mem(&err_buf);
+ mutex_lock(data, CACHE_MTX);
goto retry;
} else
cache->write_err = 0;
Powered by blists - more mailing lists