]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: limit entries returned when counting fsmap records
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 1 Oct 2020 22:21:48 +0000 (15:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Oct 2020 09:38:22 +0000 (10:38 +0100)
commit3abb2ac9594b3a7a54086e05452dba25a011a78b
tree2da65173d6dbef32c21f4b52947e7cf42f4f82a3
parent95e7b4ee3d35c8d2bca4ad3c3365abdea0bbb71d
ext4: limit entries returned when counting fsmap records

[ Upstream commit af8c53c8bc087459b1aadd4c94805d8272358d79 ]

If userspace asked fsmap to try 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: 0c9ec4beecac ("ext4: support GETFSMAP ioctls")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Link: https://lore.kernel.org/r/20201001222148.GA49520@magnolia
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/fsmap.c