Skip to content

Commit cc1dfa8

Browse files
thomastaioracleAstralBob
authored andcommitted
gfs2: fix slab corruption during mounting and umounting gfs file system
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 57c7310 ("GFS2: use kmalloc for lvb bitmap") Signed-off-by: Thomas Tai <[email protected]> Signed-off-by: Bob Peterson <[email protected]> Reviewed-by: Liam R. Howlett <[email protected]>
1 parent b066a4e commit cc1dfa8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/gfs2/lock_dlm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,7 @@ static void free_recover_size(struct lm_lockstruct *ls)
10591059
ls->ls_recover_submit = NULL;
10601060
ls->ls_recover_result = NULL;
10611061
ls->ls_recover_size = 0;
1062+
ls->ls_lvb_bits = NULL;
10621063
}
10631064

10641065
/* dlm calls before it does lock recovery */

0 commit comments

Comments
 (0)