[lkml]   [2018]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3.18 05/83] gfs2: Dont leave s_fs_info pointing to freed memory in init_sbd
3.18-stable review patch.  If anyone has any objections, please let me know.


From: Andrew Price <>

commit 4c62bd9cea7bcf10292f7e4c57a2bca332942697 upstream.

When alloc_percpu() fails, sdp gets freed but sb->s_fs_info still points
to the same address. Move the assignment after that error check so that
s_fs_info can only point to a valid sdp or NULL, which is checked for
later in the error path, in gfs2_kill_super().

Signed-off-by: Andrew Price <>
Signed-off-by: Bob Peterson <>
Signed-off-by: Greg Kroah-Hartman <>

fs/gfs2/ops_fstype.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -71,13 +71,13 @@ static struct gfs2_sbd *init_sbd(struct
if (!sdp)
return NULL;

- sb->s_fs_info = sdp;
sdp->sd_vfs = sb;
sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats);
if (!sdp->sd_lkstats) {
return NULL;
+ sb->s_fs_info = sdp;

set_bit(SDF_NOJOURNALID, &sdp->sd_flags);

 \ /
  Last update: 2018-11-29 16:07    [W:0.358 / U:2.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site