From ece580372624113bf0ce9e291952801c2bb1884f Mon Sep 17 00:00:00 2001 From: ryancaicse <73822648+ryancaicse@users.noreply.github.com> Date: Mon, 1 Nov 2021 13:42:56 +0800 Subject: [PATCH] libext2fs: fix missing unlocks in the error path in unix_set_blksize() https://github.com/tytso/e2fsprogs/pull/83 Signed-off-by: Ryan Cai Signed-off-by: Theodore Ts'o --- lib/ext2fs/unix_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index d251c20..50ac737 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -957,8 +957,11 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize) mutex_lock(data, CACHE_MTX); mutex_lock(data, BOUNCE_MTX); #ifndef NO_IO_CACHE - if ((retval = flush_cached_blocks(channel, data, FLUSH_NOLOCK))) + if ((retval = flush_cached_blocks(channel, data, FLUSH_NOLOCK))){ + mutex_unlock(data, BOUNCE_MTX); + mutex_unlock(data, CACHE_MTX); return retval; + } #endif channel->block_size = blksize; -- 1.8.3.1