linux/fs/gfs2
Hillf Danton 86fd5b27db gfs2: Fix use-after-free in gfs2_glock_shrink_scan
[ Upstream commit 1ab19c5de4c537ec0d9b21020395a5b5a6c059b2 ]

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-18 09:58:59 +02:00
..
acl.c
acl.h
aops.c
aops.h
bmap.c gfs2: Recursive gfs2_quota_hold in gfs2_iomap_end 2021-03-04 10:26:51 +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
glops.h
incore.h gfs2: use-after-free in sysfs deregistration 2020-11-05 11:43:21 +01:00
inode.c
inode.h
Kconfig
lock_dlm.c gfs2: Don't skip dlm unlock if glock has an lvb 2021-03-04 10:26:51 +01:00
log.c
log.h
lops.c
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:43:21 +01:00
quota.c
quota.h
recovery.c
recovery.h
rgrp.c gfs2: check for empty rgrp tree in gfs2_ri_update 2020-12-11 13:23:32 +01: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
trans.h
util.c
util.h
xattr.c
xattr.h