]> www.infradead.org Git - users/dwmw2/linux.git/commit
xfs: fix finding a last resort AG in xfs_filestream_pick_ag
authorChristoph Hellwig <hch@lst.de>
Wed, 23 Oct 2024 13:37:22 +0000 (15:37 +0200)
committerCarlos Maiolino <cem@kernel.org>
Wed, 30 Oct 2024 10:27:18 +0000 (11:27 +0100)
commitdc60992ce76fbc2f71c2674f435ff6bde2108028
tree0491b2bac78836237d49bb0f00b5bb75146c4e36
parent3ef22684038aa577c10972ee9c6a2455f5fac941
xfs: fix finding a last resort AG in xfs_filestream_pick_ag

When the main loop in xfs_filestream_pick_ag fails to find a suitable
AG it tries to just pick the online AG.  But the loop for that uses
args->pag as loop iterator while the later code expects pag to be
set.  Fix this by reusing the max_pag case for this last resort, and
also add a check for impossible case of no AG just to make sure that
the uninitialized pag doesn't even escape in theory.

Reported-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
Fixes: f8f1ed1ab3baba ("xfs: return a referenced perag from filestreams allocator")
Cc: <stable@vger.kernel.org> # v6.3
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_filestream.c
fs/xfs/xfs_trace.h