“638f44163d57f87d0905fbed7d54202beff916fc”上不存在“fs/xfs/libxfs/xfs_inode_buf.h”
提交 acd1ac3a 编写于 作者: D Darrick J. Wong

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: e89c0413 ("xfs: implement the GETFSMAP ioctl")
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NChandan Babu R <chandanrlinux@gmail.com>
上级 74f4d6a1
...@@ -256,6 +256,9 @@ xfs_getfsmap_helper( ...@@ -256,6 +256,9 @@ xfs_getfsmap_helper(
/* Are we just counting mappings? */ /* Are we just counting mappings? */
if (info->head->fmh_count == 0) { if (info->head->fmh_count == 0) {
if (info->head->fmh_entries == UINT_MAX)
return -ECANCELED;
if (rec_daddr > info->next_daddr) if (rec_daddr > info->next_daddr)
info->head->fmh_entries++; info->head->fmh_entries++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册