bh was not released after error in ext4_journal_get_write_access()

Fixes ac27a0ec112a ("ext4: initial copy of files from ext3")
#? cc: stable <sta...@vger.kernel.org>     # 2.6.19 or even earlier in ext3

Signed-off-by: Vasily Averin <v...@openvz.org>
---
 fs/ext4/resize.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index ff8389ac4769..26bcb53e5869 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1122,8 +1122,10 @@ static void update_backups(struct super_block *sb, 
sector_t blk_off, char *data,
                           backup_block, backup_block -
                           ext4_group_first_block_no(sb, group));
                BUFFER_TRACE(bh, "get_write_access");
-               if ((err = ext4_journal_get_write_access(handle, bh)))
+               if ((err = ext4_journal_get_write_access(handle, bh))) {
+                       brelse(bh);
                        break;
+               }
                lock_buffer(bh);
                memcpy(bh->b_data, data, size);
                if (rest)
-- 
2.17.1

Reply via email to