Whamcloud - gitweb
LU-6961 ldiskfs: buffer head leak in mmp 41/17841/5
authorJadhav Vikram <jadhav.vikram@seagate.com>
Tue, 5 Jan 2016 09:32:24 +0000 (15:02 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 25 Jan 2016 01:58:00 +0000 (01:58 +0000)
Release bh_check in case of error.
patch added for following kernel
RHEL7.2 3.10.0-327.3.1.el7
SLES11SP3 3.0.101-0.47.55
SLES12 - since the code is fairly same across RHEL7 versions
adding the patch from RHEL7 to the SLES12 patch series.

Seagate-bug-id: MRP-2337
Signed-off-by: Jadhav Vikram <jadhav.vikram@seagate.com>
Change-Id: Ib3712abcc3e754077882f9302b6065e38e1f014c
Reviewed-on: http://review.whamcloud.com/17841
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@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
ldiskfs/kernel_patches/patches/rhel7/ext4-mmp-brelse.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/sles11sp3/ext4-mmp-brelse.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.series
ldiskfs/kernel_patches/series/ldiskfs-3.12-sles12.series

index 3221b25..5ce0da8 100644 (file)
@@ -156,7 +156,7 @@ Index: linux-stage/fs/ext4/mmp.c
 ===================================================================
 --- /dev/null
 +++ linux-stage/fs/ext4/mmp.c
-@@ -0,0 +1,356 @@
+@@ -0,0 +1,357 @@
 +#include <linux/fs.h>
 +#include <linux/random.h>
 +#include <linux/buffer_head.h>
@@ -220,6 +220,7 @@ Index: linux-stage/fs/ext4/mmp.c
 +       mmp = (struct mmp_struct *)((*bh)->b_data);
 +       if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
 +              brelse(*bh);
++              *bh = NULL;
 +               return -EINVAL;
 +      }
 +
index 10637ef..70f04bb 100644 (file)
@@ -156,7 +156,7 @@ Index: linux-stage/fs/ext4/mmp.c
 ===================================================================
 --- /dev/null
 +++ linux-stage/fs/ext4/mmp.c
-@@ -0,0 +1,356 @@
+@@ -0,0 +1,357 @@
 +#include <linux/fs.h>
 +#include <linux/random.h>
 +#include <linux/buffer_head.h>
@@ -220,6 +220,7 @@ Index: linux-stage/fs/ext4/mmp.c
 +       mmp = (struct mmp_struct *)((*bh)->b_data);
 +       if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
 +              brelse(*bh);
++              *bh = NULL;
 +               return -EINVAL;
 +      }
 +
diff --git a/ldiskfs/kernel_patches/patches/rhel7/ext4-mmp-brelse.patch b/ldiskfs/kernel_patches/patches/rhel7/ext4-mmp-brelse.patch
new file mode 100644 (file)
index 0000000..486beb2
--- /dev/null
@@ -0,0 +1,23 @@
+--- linux-stage.orig/fs/ext4/mmp.c     2015-10-06 08:21:12.013939184 +0530
++++ linux-stage/fs/ext4/mmp.c  2015-10-06 08:20:35.242939292 +0530
+@@ -99,8 +99,11 @@ static int read_mmp_block(struct super_b
+       mmp = (struct mmp_struct *)((*bh)->b_data);
+       if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC ||
+-          !ext4_mmp_csum_verify(sb, mmp))
++          !ext4_mmp_csum_verify(sb, mmp)) {
++              brelse(*bh);
++              *bh = NULL;
+               return -EINVAL;
++      }
+       return 0;
+ }
+@@ -219,6 +221,7 @@ static int kmmpd(void *data)
+                                            "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/sles11sp3/ext4-mmp-brelse.patch b/ldiskfs/kernel_patches/patches/sles11sp3/ext4-mmp-brelse.patch
new file mode 100644 (file)
index 0000000..d74007e
--- /dev/null
@@ -0,0 +1,23 @@
+--- linux-stage.orig/fs/ext4/mmp.c     2015-11-01 15:42:38.069175571 +0530
++++ linux-stage/fs/ext4/mmp.c  2015-11-01 15:46:53.840174791 +0530
+@@ -59,8 +59,11 @@
+       }
+       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);
++              *bh = NULL;
+               return -EINVAL;
++      }
+       return 0;
+ }
+@@ -178,6 +180,7 @@
+                                            "The filesystem seems to have been"
+                                            " multiply mounted.");
+                               ext4_error(sb, "abort");
++                              put_bh(bh_check);
+                               goto failed;
+                       }
+                       put_bh(bh_check);
index 4630175..9cb4ecd 100644 (file)
@@ -39,3 +39,4 @@ rhel6.3/ext4-journal-path-opt.patch
 sles11sp2/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
 rhel6.3/ext4-notalloc_under_idatasem.patch
 rhel6.5/ext4-give-warning-with-dir-htree-growing.patch
+sles11sp3/ext4-mmp-brelse.patch
index 51fdeba..1e673fd 100644 (file)
@@ -17,3 +17,4 @@ rhel7.2/ext4-pdirop.patch
 rhel7/ext4-max-dir-size.patch
 rhel7/ext4-remove-truncate-warning.patch
 rhel7/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
+rhel7/ext4-mmp-brelse.patch
index fc947ed..cee174a 100644 (file)
@@ -18,3 +18,4 @@ rhel7/ext4-max-dir-size.patch
 rhel7/ext4-remove-truncate-warning.patch
 rhel7/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
 rhel7/ext4-give-warning-with-dir-htree-growing.patch
+rhel7/ext4-mmp-brelse.patch
index d644b58..2c303c1 100644 (file)
@@ -17,3 +17,4 @@ sles12/ext4-pdirop.patch
 rhel7/ext4-max-dir-size.patch
 rhel7/ext4-remove-truncate-warning.patch
 sles12/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
+rhel7/ext4-mmp-brelse.patch