From: Vasily Averin Date: Tue, 6 Nov 2018 21:49:50 +0000 (-0500) Subject: ext4: avoid buffer leak on shutdown in ext4_mark_iloc_dirty() X-Git-Tag: v4.18.20~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aac055dfa4eeaeb534460d18be5141d6be97a35f;p=thirdparty%2Fkernel%2Fstable.git ext4: avoid buffer leak on shutdown in ext4_mark_iloc_dirty() commit a6758309a005060b8297a538a457c88699cb2520 upstream. ext4_mark_iloc_dirty() callers expect that it releases iloc->bh even if it returns an error. Fixes: 0db1ff222d40 ("ext4: add shutdown bit and check for it") Signed-off-by: Vasily Averin Signed-off-by: Theodore Ts'o Cc: stable@kernel.org # 4.11 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 2276137d00831..fc05c7f7bbcf3 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5763,9 +5763,10 @@ int ext4_mark_iloc_dirty(handle_t *handle, { int err = 0; - if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) + if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { + put_bh(iloc->bh); return -EIO; - + } if (IS_I_VERSION(inode)) inode_inc_iversion(inode);