xfs: validate block number being freed before adding to xefi
authorDave Chinner <dchinner@redhat.com>
Mon, 5 Jun 2023 04:48:15 +0000 (14:48 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 5 Jun 2023 04:48:15 +0000 (14:48 +1000)
commit7dfee17b13e5024c5c0ab1911859ded4182de3e5
tree50a2ec77f1c5291f2d10d5f910c5eeeb7e348402
parent3148ebf2c0782340946732bfaf3073d23ac833fa
xfs: validate block number being freed before adding to xefi

Bad things happen in defered extent freeing operations if it is
passed a bad block number in the xefi. This can come from a bogus
agno/agbno pair from deferred agfl freeing, or just a bad fsbno
being passed to __xfs_free_extent_later(). Either way, it's very
difficult to diagnose where a null perag oops in EFI creation
is coming from when the operation that queued the xefi has already
been completed and there's no longer any trace of it around....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_ag.c
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_alloc.h
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap_btree.c
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/xfs_reflink.c