linux/fs/gfs2
Bob Peterson ebb3b84596 gfs2: assign rgrp glock before compute_bitstructs
commit 428f651cb80b227af47fc302e4931791f2fb4741 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:50:45 +02:00
..
Kconfig
Makefile
acl.c
acl.h
aops.c
aops.h
bmap.c gfs2: Fix length of holes reported at end-of-file 2021-12-08 09:01:08 +01:00
bmap.h
dentry.c
dir.c
dir.h
export.c
file.c gfs2: Prevent direct-I/O write fallback errors from getting lost 2021-06-18 09:58:58 +02:00
gfs2.h
glock.c gfs2: Fix use-after-free in gfs2_glock_shrink_scan 2021-06-18 09:58:59 +02:00
glock.h
glops.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 12:40:33 +02:00
glops.h
incore.h gfs2: use-after-free in sysfs deregistration 2020-11-05 11:43:21 +01:00
inode.c gfs2: clean up iopen glock mess in gfs2_create_inode 2020-10-01 13:17:20 +02:00
inode.h
lock_dlm.c gfs2: Don't call dlm after protocol is unmounted 2021-09-22 12:26:33 +02:00
log.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 12:40:33 +02:00
log.h
lops.c gfs2: Even more gfs2_find_jhead fixes 2020-06-17 16:40:21 +02:00
lops.h
main.c
meta_io.c
meta_io.h
ops_fstype.c gfs2: add validation checks for size of superblock 2020-11-05 11:43:21 +01:00
quota.c gfs2: move privileged user check to gfs2_quota_lock_check 2020-06-03 08:21:09 +02:00
quota.h gfs2: move privileged user check to gfs2_quota_lock_check 2020-06-03 08:21:09 +02:00
recovery.c
recovery.h
rgrp.c gfs2: assign rgrp glock before compute_bitstructs 2022-04-27 13:50:45 +02:00
rgrp.h
super.c gfs2: report "already frozen/thawed" errors 2021-04-16 11:46:37 +02:00
super.h
sys.c gfs2: use-after-free in sysfs deregistration 2020-11-05 11:43:21 +01:00
sys.h
trace_gfs2.h
trans.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 12:40:33 +02:00
trans.h
util.c
util.h
xattr.c
xattr.h