linux-stable/fs/gfs2
Hillf Danton 094bf5670e gfs2: Fix use-after-free in gfs2_glock_shrink_scan
[ Upstream commit 1ab19c5de4 ]

The GLF_LRU flag is checked under lru_lock in gfs2_glock_remove_from_lru() to
remove the glock from the lru list in __gfs2_glock_put().

On the shrink scan path, the same flag is cleared under lru_lock but because
of cond_resched_lock(&lru_lock) in gfs2_dispose_glock_lru(), progress on the
put side can be made without deleting the glock from the lru list.

Keep GLF_LRU across the race window opened by cond_resched_lock(&lru_lock) to
ensure correct behavior on both sides - clear GLF_LRU after list_del under
lru_lock.

Reported-by: syzbot <syzbot+34ba7ddbf3021981a228@syzkaller.appspotmail.com>
Signed-off-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-30 08:48:11 -04:00
..
acl.c
acl.h
aops.c
aops.h
bmap.c gfs2: Another gfs2_walk_metadata fix 2020-05-20 08:18:41 +02: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-30 08:48:11 -04:00
gfs2.h
glock.c gfs2: Fix use-after-free in gfs2_glock_shrink_scan 2021-06-30 08:48:11 -04:00
glock.h
glops.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 12:10:56 +02:00
glops.h
incore.h gfs2: slow the deluge of io error messages 2019-11-24 08:20:26 +01:00
inode.c gfs2: clean up iopen glock mess in gfs2_create_inode 2020-10-01 13:14:28 +02:00
inode.h
Kconfig
lock_dlm.c gfs2: Don't skip dlm unlock if glock has an lvb 2021-03-04 09:39:57 +01:00
log.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 12:10:56 +02:00
log.h gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-12-17 20:35:55 +01:00
lops.c gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-12-17 20:35:55 +01:00
lops.h
main.c
Makefile
meta_io.c
meta_io.h
ops_fstype.c gfs2: add validation checks for size of superblock 2020-11-05 11:08:44 +01:00
quota.c gfs2: move privileged user check to gfs2_quota_lock_check 2020-06-03 08:19:28 +02:00
quota.h gfs2: move privileged user check to gfs2_quota_lock_check 2020-06-03 08:19:28 +02:00
recovery.c
recovery.h
rgrp.c gfs2: check for empty rgrp tree in gfs2_ri_update 2020-12-11 13:25:04 +01:00
rgrp.h
super.c gfs2: report "already frozen/thawed" errors 2021-04-16 11:49:30 +02:00
super.h
sys.c
sys.h
trace_gfs2.h
trans.c gfs2: initialize transaction tr_ailX_lists earlier 2020-09-23 12:10:56 +02:00
trans.h
util.c gfs2: slow the deluge of io error messages 2019-11-24 08:20:26 +01:00
util.h
xattr.c
xattr.h