Description: ext4: Buffer Head Leak In mmp There is memory leak as both caller function kmmpd() and callee read_mmp_block() not releasing bh_check (i.e buffer_head). Given patch fixes this problem. Signed-off-by: Jadhav Vikram <vikramjadhavpucsd2007@xxxxxxxxx> Patch: ===== --- /root/linux.orig/fs/ext4/mmp.c 2016-01-18 07:23:06.227519005 +0530 +++ /root/linux/fs/ext4/mmp.c 2016-01-18 07:31:18.545518552 +0530 @@ -98,12 +98,17 @@ } mmp = (struct mmp_struct *)((*bh)->b_data); - if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) + if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) { ret = -EFSCORRUPTED; - else if (!ext4_mmp_csum_verify(sb, mmp)) + brelse(*bh); + *bh = NULL; + } else if (!ext4_mmp_csum_verify(sb, mmp)) { ret = -EFSBADCRC; - else + brelse(*bh); + *bh = NULL; + } else { return 0; + } warn_exit: ext4_warning(sb, "Error %d while reading MMP block %llu", @@ -225,6 +230,7 @@ "The filesystem seems to have been" " multiply mounted."); ext4_error(sb, "abort"); + put_bh(bh_check); goto failed; } put_bh(bh_check);
Attachment:
ext4-mmp-brelse.patch
Description: Binary data