xfs: fix exchmaps reservation limit check
Subsystems (2)
cover xfs: fix exchmaps reservation limit check
Hi all,
This patch fixes the final reservation limit check in xfs_exchmaps_estimate_overhead().
The helper adds bmbt and rmapbt overhead to a local variable, so the UINT_MAX check should test the computed reservation rather than the initial request value.
Thanks,
Yingjie
Yingjie Gao (1):
xfs: fix exchmaps reservation limit check
fs/xfs/libxfs/xfs_exchmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.20.1
PATCH 1/1 xfs: fix exchmaps reservation limit check
xfs_exchmaps_estimate_overhead() adds the bmbt and rmapbt overhead to a local resblks variable, but the final UINT_MAX check still tests req->resblks. That is the reservation value from before the overhead was added.
The computed value is stored back in req->resblks and later passed to xfs_trans_alloc(), whose block reservation argument is unsigned int. Check the computed reservation so the existing limit applies to the value that will be used.
--- fs/xfs/libxfs/xfs_exchmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_exchmaps.c +1 -1
@@ -711,7 +711,7 @@ xfs_exchmaps_estimate_overhead(return -ENOSPC ;/* Can't actually reserve more than UINT_MAX blocks. */ -if (req->resblks >UINT_MAX ) +if (resblks >UINT_MAX )return -ENOSPC ; req->resblks = resblks;
Signature · 1 line
2.20.1
Quoted 5 lines · Yingjie Gao
xfs_exchmaps_estimate_overhead()adds the bmbt and rmapbt overhead to a local resblks variable, but the finalUINT_MAXcheck still testsreq->resblks. That is the reservation value from before the overhead was added.
Quoted 8 lines
The computed value is stored back in
req->resblksand later passed toxfs_trans_alloc(), whose block reservation argument is unsigned int. Check the computed reservation so the existing limit applies to the value that will be used.Fixes 966ceafc7a43 ("xfs: create deferred log items for file mapping exchanges")Cc <[email protected]> # v6.10Signed-off-by Yingjie Gao <[email protected]>
Oops. That's a good catch!
--D
Quoted 20 lines
--- fs/xfs/libxfs/xfs_exchmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_exchmaps.c +1
-1@@ -711,7 +711,7 @@ xfs_exchmaps_estimate_overhead(return -ENOSPC ;/* Can't actually reserve more than UINT_MAX blocks. */ -if (req->resblks >UINT_MAX ) +if (resblks >UINT_MAX )return -ENOSPC ; req->resblks = resblks;Signature · 1 line
2.20.1
Quoted 11 lines · Yingjie Gao
xfs_exchmaps_estimate_overhead()adds the bmbt and rmapbt overhead to a local resblks variable, but the finalUINT_MAXcheck still testsreq->resblks. That is the reservation value from before the overhead was added.The computed value is stored back in
req->resblksand later passed toxfs_trans_alloc(), whose block reservation argument is unsigned int. Check the computed reservation so the existing limit applies to the value that will be used.[...]
Applied to for-next, thanks!
[1/1] xfs: fix exchmaps reservation limit check
commit: 0a5213bbff62b51c7d4999ac8c7e11ea57d00d45
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>