mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 00:39:48 +00:00
xfs: limit entries returned when counting fsmap records
[ Upstream commitacd1ac3aa2
] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f6cb0dcfee
commit
1577152a3a
1 changed files with 3 additions and 0 deletions
|
@ -273,6 +273,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…
Reference in a new issue