From: Jadhav Vikram Date: Thu, 6 Aug 2015 01:41:30 +0000 (+0530) Subject: LU-6961 ldiskfs: buffer head leak in mmp X-Git-Tag: 2.7.61~12 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6948fa26bcefaec19071393216c4d0a7aac6392e;p=fs%2Flustre-release.git LU-6961 ldiskfs: buffer head leak in mmp Release bh_check in case of error. Seagate-bug-id: MRP-2337 Signed-off-by: Jadhav Vikram Signed-off-by: Rahul Deshmukh Signed-off-by: Andriy Skulysh Change-Id: I818dbaa22d61e1cc7e66f97c218333e39c6c8afa Reviewed-on: http://review.whamcloud.com/15872 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch index 8396e93..3221b25 100644 --- a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch +++ b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch @@ -156,7 +156,7 @@ Index: linux-stage/fs/ext4/mmp.c =================================================================== --- /dev/null +++ linux-stage/fs/ext4/mmp.c -@@ -0,0 +1,354 @@ +@@ -0,0 +1,356 @@ +#include +#include +#include @@ -218,8 +218,10 @@ Index: linux-stage/fs/ext4/mmp.c + } + + 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) { ++ brelse(*bh); + return -EINVAL; ++ } + + return 0; +} @@ -324,7 +326,6 @@ Index: linux-stage/fs/ext4/mmp.c + if (retval) { + ext4_error(sb, "error reading MMP data: %d", + retval); -+ + EXT4_SB(sb)->s_mmp_tsk = NULL; + goto failed; + } @@ -338,6 +339,7 @@ Index: linux-stage/fs/ext4/mmp.c + "The filesystem seems to have been" + " multiply mounted."); + ext4_error(sb, "abort"); ++ put_bh(bh_check); + goto failed; + } + put_bh(bh_check); diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch index fd60b3b..10637ef 100644 --- a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch +++ b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch @@ -156,7 +156,7 @@ Index: linux-stage/fs/ext4/mmp.c =================================================================== --- /dev/null +++ linux-stage/fs/ext4/mmp.c -@@ -0,0 +1,354 @@ +@@ -0,0 +1,356 @@ +#include +#include +#include @@ -218,8 +218,10 @@ Index: linux-stage/fs/ext4/mmp.c + } + + 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) { ++ brelse(*bh); + return -EINVAL; ++ } + + return 0; +} @@ -324,7 +326,6 @@ Index: linux-stage/fs/ext4/mmp.c + if (retval) { + ext4_error(sb, "error reading MMP data: %d", + retval); -+ + EXT4_SB(sb)->s_mmp_tsk = NULL; + goto failed; + } @@ -338,6 +339,7 @@ Index: linux-stage/fs/ext4/mmp.c + "The filesystem seems to have been" + " multiply mounted."); + ext4_error(sb, "abort"); ++ put_bh(bh_check); + goto failed; + } + put_bh(bh_check);