Whamcloud - gitweb
libext2fs: fix missing unlocks in the error path in unix_set_blksize()
authorryancaicse <73822648+ryancaicse@users.noreply.github.com>
Mon, 1 Nov 2021 05:42:56 +0000 (13:42 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 3 Dec 2021 19:31:09 +0000 (14:31 -0500)
https://github.com/tytso/e2fsprogs/pull/83

Signed-off-by: Ryan Cai <ryancaicse@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/unix_io.c

index d251c20..50ac737 100644 (file)
@@ -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;