]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xfs: avoid dereferencing log items after push callbacks
authorYuto Ohnuki <ytohnuki@amazon.com>
Tue, 10 Mar 2026 18:38:38 +0000 (18:38 +0000)
committerCarlos Maiolino <cem@kernel.org>
Wed, 18 Mar 2026 08:40:31 +0000 (09:40 +0100)
commit79ef34ec0554ec04bdbafafbc9836423734e1bd6
treedfbb181b2c9a2ce970f4540fadd58ba4cc7eb791
parent4f24a767e3d64a5f58c595b5c29b6063a201f1e3
xfs: avoid dereferencing log items after push callbacks

After xfsaild_push_item() calls iop_push(), the log item may have been
freed if the AIL lock was dropped during the push. Background inode
reclaim or the dquot shrinker can free the log item while the AIL lock
is not held, and the tracepoints in the switch statement dereference
the log item after iop_push() returns.

Fix this by capturing the log item type, flags, and LSN before calling
xfsaild_push_item(), and introducing a new xfs_ail_push_class trace
event class that takes these pre-captured values and the ailp pointer
instead of the log item pointer.

Reported-by: syzbot+652af2b3c5569c4ab63c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=652af2b3c5569c4ab63c
Fixes: 90c60e164012 ("xfs: xfs_iflush() is no longer necessary")
Cc: stable@vger.kernel.org # v5.9
Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_trace.h
fs/xfs/xfs_trans_ail.c