Whamcloud - gitweb
LU-6961 ldiskfs: buffer head leak in mmp 72/15872/3
authorJadhav Vikram <jadhav.vikram@seagate.com>
Thu, 6 Aug 2015 01:41:30 +0000 (07:11 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 2 Oct 2015 04:14:12 +0000 (04:14 +0000)
Release bh_check in case of error.

Seagate-bug-id: MRP-2337
Signed-off-by: Jadhav Vikram <jadhav.vikram@seagate.com>
Signed-off-by: Rahul Deshmukh <rahul.deshmukh@seagate.com>
Signed-off-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Change-Id: I818dbaa22d61e1cc7e66f97c218333e39c6c8afa
Reviewed-on: http://review.whamcloud.com/15872
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch
ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch

index 8396e93..3221b25 100644 (file)
@@ -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 <linux/fs.h>
 +#include <linux/random.h>
 +#include <linux/buffer_head.h>
@@ -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);
index fd60b3b..10637ef 100644 (file)
@@ -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 <linux/fs.h>
 +#include <linux/random.h>
 +#include <linux/buffer_head.h>
@@ -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);