]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Apr 2026 12:16:37 +0000 (14:16 +0200)
commitc8a2ab339b88d10fc34a3318c92f07d8a467019d
tree75900c55ff706f04838594d65ca244f5fd9aaca7
parent4a977fcc0d6a45e07251b27342edb12f3c6a7ead
xfs: avoid dereferencing log items after push callbacks

commit 79ef34ec0554ec04bdbafafbc9836423734e1bd6 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_trace.c
fs/xfs/xfs_trace.h
fs/xfs/xfs_trans_ail.c