]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xfs: limit entries returned when counting fsmap records
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 1 Oct 2020 17:56:07 +0000 (10:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:53 +0000 (10:07 +0100)
commit29eedbf9e39d460034a05e711d4cb1b8874db188
tree2babfbc62af17bb38d28c2e78d8a911d77fd217e
parentc32adb866dac7ece9e50151e930b293ca8b52bd8
xfs: limit entries returned when counting fsmap records

[ Upstream commit acd1ac3aa22fd58803a12d26b1ab7f70232f8d8d ]

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: e89c041338ed ("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>
fs/xfs/xfs_fsmap.c