]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xfs: save ailp before dropping the AIL lock in push callbacks
authorYuto Ohnuki <ytohnuki@amazon.com>
Tue, 10 Mar 2026 18:38:39 +0000 (18:38 +0000)
committerCarlos Maiolino <cem@kernel.org>
Wed, 18 Mar 2026 08:40:31 +0000 (09:40 +0100)
commit394d70b86fae9fe865e7e6d9540b7696f73aa9b6
treeeee2742abb41ad484669b4696a157bdce4bb0244
parent79ef34ec0554ec04bdbafafbc9836423734e1bd6
xfs: save ailp before dropping the AIL lock in push callbacks

In xfs_inode_item_push() and xfs_qm_dquot_logitem_push(), the AIL lock
is dropped to perform buffer IO. Once the cluster buffer no longer
protects the log item from reclaim, the log item may be freed by
background reclaim or the dquot shrinker. The subsequent spin_lock()
call dereferences lip->li_ailp, which is a use-after-free.

Fix this by saving the ailp pointer in a local variable while the AIL
lock is held and the log item is guaranteed to be valid.

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
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_dquot_item.c
fs/xfs/xfs_inode_item.c