All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 21/29] gfs2: fix slab corruption during mounting and umounting gfs file system
Date: Sun,  3 Sep 2017 21:51:09 -0500	[thread overview]
Message-ID: <20170904025117.14737-22-rpeterso@redhat.com> (raw)
In-Reply-To: <20170904025117.14737-1-rpeterso@redhat.com>

From: Thomas Tai <thomas.tai@oracle.com>

When using cman-3.0.12.1 and gfs2-utils-3.0.12.1, mounting and
unmounting GFS2 file system would cause kernel to hang. The slab
allocator suggests that it is likely a double free memory corruption.
The issue is traced back to v3.9-rc6 where a patch is submitted to
use kzalloc() for storing a bitmap instead of using a local variable.
The intention is to allocate memory during mount and to free memory
during unmount. The original patch misses a code path which has
already freed the memory and caused memory corruption. This patch sets
the memory pointer to NULL after the memory is freed, so that double
free memory corruption will not happen.

gdlm_mount()
  '-- set_recover_size() which use kzalloc()
  '-- if dlm does not support ops callbacks then
          '--- free_recover_size() which use kfree()

gldm_unmount()
  '-- free_recover_size() which use kfree()

Previous patch which introduced the double free issue is
commit 57c7310b8eb9 ("GFS2: use kmalloc for lvb bitmap")

Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 fs/gfs2/lock_dlm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 0515f0a68637..1d98b8a36eb3 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -1059,6 +1059,7 @@ static void free_recover_size(struct lm_lockstruct *ls)
 	ls->ls_recover_submit = NULL;
 	ls->ls_recover_result = NULL;
 	ls->ls_recover_size = 0;
+	ls->ls_lvb_bits = NULL;
 }
 
 /* dlm calls before it does lock recovery */
-- 
2.13.5



  parent reply	other threads:[~2017-09-04  2:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04  2:50 [Cluster-devel] [PATCH 00/29] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 01/29] GFS2: Prevent double brelse in gfs2_meta_indirect_buffer Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 02/29] gfs2: Lock holder cleanup (fixup) Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 03/29] gfs2: Don't clear SGID when inheriting ACLs Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 04/29] gfs2: Fixup to "Get rid of flush_delayed_work in gfs2_evict_inode" Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 05/29] GFS2: fix code parameter error in inode_go_lock Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 06/29] gfs2: add flag REQ_PRIO for metadata I/O Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 07/29] GFS2: Introduce helper for clearing gl_object Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 08/29] GFS2: Set gl_object in inode lookup only after block type check Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 09/29] GFS2: Clear gl_object if gfs2_create_inode fails Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 10/29] GFS2: Clear gl_object when deleting an inode in gfs2_delete_inode Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 11/29] GFS2: Don't bother trying to add rgrps to the lru list Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 12/29] GFS2: Don't waste time locking lru_lock for non-lru glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 13/29] GFS2: Delete debugfs files only after we evict the glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 14/29] gfs2: Fix trivial typos Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 15/29] gfs2: gfs2_glock_get: Wait on freeing glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 16/29] gfs2: Get rid of gfs2_set_nlink Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 17/29] gfs2: gfs2_evict_inode: Put glocks asynchronously Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 18/29] gfs2: Defer deleting inodes under memory pressure Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 19/29] gfs2: Clean up waiting on glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 20/29] gfs2: forcibly flush ail to relieve memory pressure Bob Peterson
2017-09-04  2:51 ` Bob Peterson [this message]
2017-09-04  2:51 ` [Cluster-devel] [PATCH 22/29] GFS2: Withdraw for IO errors writing to the journal or statfs Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 23/29] gfs2: Silence gcc format-truncation warning Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 24/29] GFS2: Fix up some sparse warnings Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 25/29] GFS2: Fix gl_object warnings Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 26/29] gfs2: constify rhashtable_params Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 27/29] GFS2: Fix non-recursive truncate bug Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 28/29] gfs2: don't return ENODATA in __gfs2_xattr_set unless replacing Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 29/29] gfs2: preserve i_mode if __gfs2_set_acl() fails Bob Peterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170904025117.14737-22-rpeterso@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.