mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
xfs: limit entries returned when counting fsmap records
If userspace asked fsmap to count the number of entries, we cannot
return more than UINT_MAX entries because fmh_entries is u32.
Therefore, stop counting if we hit this limit or else we will waste time
to return truncated results.
Fixes: e89c041338
("xfs: implement the GETFSMAP ioctl")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
This commit is contained in:
parent
74f4d6a1e0
commit
acd1ac3aa2
1 changed files with 3 additions and 0 deletions
|
@ -256,6 +256,9 @@ xfs_getfsmap_helper(
|
|||
|
||||
/* Are we just counting mappings? */
|
||||
if (info->head->fmh_count == 0) {
|
||||
if (info->head->fmh_entries == UINT_MAX)
|
||||
return -ECANCELED;
|
||||
|
||||
if (rec_daddr > info->next_daddr)
|
||||
info->head->fmh_entries++;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue