linux-stable/fs/gfs2
Bob Peterson 78178ca844 gfs2: Don't skip dlm unlock if glock has an lvb
Patch fb6791d100 was designed to allow gfs2 to unmount quicker by
skipping the step where it tells dlm to unlock glocks in EX with lvbs.
This was done because when gfs2 unmounts a file system, it destroys the
dlm lockspace shortly after it destroys the glocks so it doesn't need to
unlock them all: the unlock is implied when the lockspace is destroyed
by dlm.

However, that patch introduced a use-after-free in dlm: as part of its
normal dlm_recoverd process, it can call ls_recovery to recover dead
locks. In so doing, it can call recover_rsbs which calls recover_lvb for
any mastered rsbs. Func recover_lvb runs through the list of lkbs queued
to the given rsb (if the glock is cached but unlocked, it will still be
queued to the lkb, but in NL--Unlocked--mode) and if it has an lvb,
copies it to the rsb, thus trying to preserve the lkb. However, when
gfs2 skips the dlm unlock step, it frees the glock and its lvb, which
means dlm's function recover_lvb references the now freed lvb pointer,
copying the freed lvb memory to the rsb.

This patch changes the check in gdlm_put_lock so that it calls
dlm_unlock for all glocks that contain an lvb pointer.

Fixes: fb6791d100 ("GFS2: skip dlm_unlock calls in unmount")
Cc: stable@vger.kernel.org # v3.8+
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
2021-02-05 20:08:47 +01:00
..
acl.c gfs2: Change inode qa_data to allow multiple users 2020-03-27 14:08:04 -05:00
acl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
aops.c gfs2: Fix case in which ail writes are done to jdata holes 2020-11-12 18:55:20 +01:00
aops.h gfs2: mark stuffed_readpage static 2019-07-03 14:45:18 +02:00
bmap.c Revert "gfs2: Ignore journal log writes for jdata holes" 2020-11-12 18:41:57 +01:00
bmap.h gfs2: use iomap for buffered I/O in ordered and writeback mode 2020-10-14 23:54:42 +02:00
dentry.c gfs2: untangle the logic in gfs2_drevalidate 2019-09-03 09:42:41 +02:00
dir.c mm: remove the pgprot argument to __vmalloc 2020-06-02 10:59:11 -07:00
dir.h gfs2: Delete an unnecessary check before brelse() 2019-09-04 20:22:17 +02:00
export.c gfs2: Minor gfs2_lookup_by_inum cleanup 2020-06-05 20:19:21 +02:00
file.c Changes in gfs2: 2020-08-10 18:22:43 -07:00
gfs2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
glock.c Revert "GFS2: Prevent delete work from occurring on glocks used for create" 2020-12-01 00:25:21 +01:00
glock.h Merge branch 'gfs2-iopen' into for-next 2020-06-05 21:25:36 +02:00
glops.c gfs2: Don't freeze the file system during unmount 2020-11-25 18:12:08 +01:00
glops.h gfs2: Split up gfs2_meta_sync into inode and rgrp versions 2020-10-29 22:16:46 +01:00
incore.h gfs2: keep bios separate for each journal 2021-01-25 08:08:44 -05:00
inode.c Revert "GFS2: Prevent delete work from occurring on glocks used for create" 2020-12-01 00:25:21 +01:00
inode.h gfs2: Make inode operations static 2020-12-01 00:25:21 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
lock_dlm.c gfs2: Don't skip dlm unlock if glock has an lvb 2021-02-05 20:08:47 +01:00
log.c gfs2: keep bios separate for each journal 2021-01-25 08:08:44 -05:00
log.h gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe 2020-10-15 14:29:03 +02:00
lops.c gfs2: keep bios separate for each journal 2021-01-25 08:08:44 -05:00
lops.h gfs2: keep bios separate for each journal 2021-01-25 08:08:44 -05:00
main.c gfs2: amend SLAB_RECLAIM_ACCOUNT on gfs2 related slab cache 2021-01-22 12:19:17 -05:00
Makefile
meta_io.c gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe 2020-10-15 14:29:03 +02:00
meta_io.h gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe 2020-10-15 14:29:03 +02:00
ops_fstype.c gfs2: Fix invalid block size message 2021-01-25 08:08:29 -05:00
quota.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
quota.h gfs2: move privileged user check to gfs2_quota_lock_check 2020-05-08 18:47:58 +02:00
recovery.c gfs2: Lock imbalance on error path in gfs2_recover_one 2021-02-05 18:18:57 +01:00
recovery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
rgrp.c gfs2: check for empty rgrp tree in gfs2_ri_update 2020-11-25 18:10:55 +01:00
rgrp.h gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump 2020-10-14 23:54:43 +02:00
super.c gfs2: move freeze glock outside the make_fs_rw and _ro functions 2020-12-23 00:54:21 +01:00
super.h gfs2: lookup local statfs inodes prior to journal recovery 2020-10-23 15:47:14 +02:00
sys.c gfs2: use-after-free in sysfs deregistration 2020-10-14 23:54:43 +02:00
sys.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
trace_gfs2.h gfs2: eliminate GLF_QUEUED flag in favor of list_empty(gl_holders) 2020-10-15 17:04:53 +02:00
trans.c gfs2: add some much needed cleanup for log flushes that fail 2020-08-24 13:54:07 +02:00
trans.h gfs2: new slab for transactions 2020-06-05 21:24:25 +02:00
util.c gfs2: fix glock confusion in function signal_our_withdraw 2021-01-25 08:08:44 -05:00
util.h gfs2: Add common helper for holding and releasing the freeze glock 2020-12-23 00:54:13 +01:00
xattr.c gfs2: Change inode qa_data to allow multiple users 2020-03-27 14:08:04 -05:00
xattr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00