1
0
Fork 0
alistair23-linux/fs/gfs2
Bob Peterson fbaf0137df gfs2: fix use-after-free on transaction ail lists
[ Upstream commit 83d060ca8d ]

Before this patch, transactions could be merged into the system
transaction by function gfs2_merge_trans(), but the transaction ail
lists were never merged. Because the ail flushing mechanism can run
separately, bd elements can be attached to the transaction's buffer
list during the transaction (trans_add_meta, etc) but quickly moved
to its ail lists. Later, in function gfs2_trans_end, the transaction
can be freed (by gfs2_trans_end) while it still has bd elements
queued to its ail lists, which can cause it to either lose track of
the bd elements altogether (memory leak) or worse, reference the bd
elements after the parent transaction has been freed.

Although I've not seen any serious consequences, the problem becomes
apparent with the previous patch's addition of:

	gfs2_assert_warn(sdp, list_empty(&tr->tr_ail1_list));

to function gfs2_trans_free().

This patch adds logic into gfs2_merge_trans() to move the merged
transaction's ail lists to the sdp transaction. This prevents the
use-after-free. To do this properly, we need to hold the ail lock,
so we pass sdp into the function instead of the transaction itself.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-24 17:50:40 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
acl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
aops.c gfs2: Minor PAGE_SIZE arithmetic cleanups 2019-09-04 20:22:06 +02:00
aops.h gfs2: mark stuffed_readpage static 2019-07-03 14:45:18 +02:00
bmap.c gfs2: Another gfs2_walk_metadata fix 2020-05-20 08:20:17 +02:00
bmap.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
dentry.c gfs2: untangle the logic in gfs2_drevalidate 2019-09-03 09:42:41 +02:00
dir.c gfs2: Delete an unnecessary check before brelse() 2019-09-04 20:22:17 +02:00
dir.h gfs2: Delete an unnecessary check before brelse() 2019-09-04 20:22:17 +02:00
export.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
file.c gfs2: fix O_SYNC write handling 2020-02-11 04:35:35 -08:00
gfs2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
glock.c Revert "gfs2: Don't demote a glock until its revokes are written" 2020-05-27 17:46:44 +02:00
glock.h gfs2: Use async glocks for rename 2019-09-04 20:22:17 +02:00
glops.c gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty 2020-04-17 10:50:03 +02:00
glops.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
incore.h Merge branch 'work.mount3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-09-24 12:33:34 -07:00
inode.c gfs2_atomic_open(): fix O_EXCL|O_CREAT handling on cold dcache 2020-03-18 07:17:51 +01:00
inode.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
lock_dlm.c gfs2: Fix recovery slot bumping 2019-09-03 09:42:41 +02:00
log.c gfs2: fix use-after-free on transaction ail lists 2020-06-24 17:50:40 +02:00
log.h gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty 2020-04-17 10:50:03 +02:00
lops.c gfs2: Even more gfs2_find_jhead fixes 2020-06-17 16:40:21 +02:00
lops.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
main.c SPDX update for 5.2-rc4 2019-06-08 12:52:42 -07:00
meta_io.c gfs2: Rename SDF_SHUTDOWN to SDF_WITHDRAWN 2019-06-27 21:26:35 +02:00
meta_io.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
ops_fstype.c gfs2: Allow lock_nolock mount to specify jid=X 2020-06-24 17:50:37 +02: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 gfs2: log which portion of the journal is replayed 2019-06-27 21:03:58 +02:00
recovery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
rgrp.c gfs2: Fix possible fs name overflows 2019-09-03 09:42:41 +02:00
rgrp.h gfs2: dump fsid when dumping glock problems 2019-06-27 21:27:43 +02:00
super.c Merge branch 'work.mount3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-09-24 12:33:34 -07:00
super.h gfs2: Convert gfs2 to fs_context 2019-09-18 22:47:05 -04:00
sys.c Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07: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 rs_inum and reduce the size of gfs2 inodes 2018-06-21 07:39:31 -05:00
trans.c gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-12-21 11:04:34 +01:00
trans.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
util.c gfs2: Fix possible fs name overflows 2019-09-03 09:42:41 +02:00
util.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
xattr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
xattr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00