linux-stable/fs/gfs2
Bob Peterson 419adf1106 gfs2: assign rgrp glock before compute_bitstructs
commit 428f651cb8 upstream.

Before this patch, function read_rindex_entry called compute_bitstructs
before it allocated a glock for the rgrp. But if compute_bitstructs found
a problem with the rgrp, it called gfs2_consist_rgrpd, and that called
gfs2_dump_glock for rgd->rd_gl which had not yet been assigned.

read_rindex_entry
   compute_bitstructs
      gfs2_consist_rgrpd
         gfs2_dump_glock <---------rgd->rd_gl was not set.

This patch changes read_rindex_entry so it assigns an rgrp glock before
calling compute_bitstructs so gfs2_dump_glock does not reference an
unassigned pointer. If an error is discovered, the glock must also be
put, so a new goto and label were added.

Reported-by: syzbot+c6fd14145e2f62ca0784@syzkaller.appspotmail.com
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-27 13:15:29 +02:00
..
acl.c gfs2: preserve i_mode if __gfs2_set_acl() fails 2017-08-31 07:53:15 -05:00
acl.h
aops.c gfs2: forcibly flush ail to relieve memory pressure 2017-08-10 10:51:03 -05:00
bmap.c gfs2: take jdata unstuff into account in do_grow 2019-12-05 15:37:32 +01:00
bmap.h
dentry.c
dir.c We've got a whopping 29 GFS2 patches for this merge window, mainly 2017-09-06 11:42:31 -07:00
dir.h
export.c
file.c gfs2: Fix fallocate chunk size 2018-05-30 07:52:35 +02:00
gfs2.h
glock.c gfs2: Fix use-after-free in gfs2_glock_shrink_scan 2021-06-30 08:48:46 -04:00
glock.h gfs2: gfs2_evict_inode: Put glocks asynchronously 2017-08-10 10:45:21 -05:00
glops.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 10:46:33 +02:00
glops.h
incore.h gfs2: Silence gcc format-truncation warning 2017-08-25 10:59:21 -05:00
inode.c gfs2: clean up iopen glock mess in gfs2_create_inode 2020-10-01 13:12:30 +02:00
inode.h
Kconfig
lock_dlm.c gfs2: Don't call dlm after protocol is unmounted 2021-09-22 11:45:30 +02:00
log.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 10:46:33 +02:00
log.h gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-12-17 20:40:01 +01:00
lops.c gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-12-17 20:40:01 +01:00
lops.h
main.c GFS2: Remove gl_list from glock structure 2017-06-12 14:39:12 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
meta_io.c Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block 2017-09-07 11:59:42 -07:00
meta_io.h
ops_fstype.c gfs2: add validation checks for size of superblock 2020-11-05 11:06:57 +01:00
quota.c gfs2: move privileged user check to gfs2_quota_lock_check 2020-06-03 08:17:52 +02:00
quota.h gfs2: move privileged user check to gfs2_quota_lock_check 2020-06-03 08:17:52 +02:00
recovery.c VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb) 2017-07-17 08:45:34 +01:00
recovery.h
rgrp.c gfs2: assign rgrp glock before compute_bitstructs 2022-04-27 13:15:29 +02:00
rgrp.h GFS2: Non-recursive delete 2017-04-19 08:25:43 -04:00
super.c gfs2: report "already frozen/thawed" errors 2021-04-16 11:57:53 +02:00
super.h
sys.c VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb) 2017-07-17 08:45:34 +01:00
sys.h
trace_gfs2.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
trans.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 10:46:33 +02:00
trans.h
util.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
util.h GFS2: Fix up some sparse warnings 2017-08-25 18:47:18 -05:00
xattr.c gfs2: don't return ENODATA in __gfs2_xattr_set unless replacing 2017-08-31 07:43:03 -05:00
xattr.h