From: Chandan Babu R <chandanrlinux@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: limit entries returned when counting fsmap records
Date: Fri, 02 Oct 2020 14:21:10 +0530 [thread overview]
Message-ID: <4857521.XMzPl6tNdl@garuda> (raw)
In-Reply-To: <160161416467.1967459.10753396346204946090.stgit@magnolia>
On Friday 2 October 2020 10:19:24 AM IST Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> 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>
The upper bound check is correct.
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
> ---
> fs/xfs/xfs_fsmap.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>
> diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
> index 4eebcec4aae6..aa36e7daf82c 100644
> --- a/fs/xfs/xfs_fsmap.c
> +++ b/fs/xfs/xfs_fsmap.c
> @@ -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++;
>
>
>
--
chandan
next prev parent reply other threads:[~2020-10-02 8:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 4:49 [PATCH 0/2] xfs: a few fixes and cleanups to GETFSMAP Darrick J. Wong
2020-10-02 4:49 ` [PATCH 1/2] xfs: limit entries returned when counting fsmap records Darrick J. Wong
2020-10-02 7:06 ` Christoph Hellwig
2020-10-02 8:51 ` Chandan Babu R [this message]
2020-10-02 4:49 ` [PATCH 2/2] xfs: streamline xfs_getfsmap performance Darrick J. Wong
2020-10-02 7:15 ` Christoph Hellwig
2020-10-02 17:58 ` Darrick J. Wong
2020-10-05 6:30 ` Christoph Hellwig
2020-10-05 17:02 ` Darrick J. Wong
2020-10-02 8:52 ` Chandan Babu R
2020-10-04 19:14 ` [PATCH v1.2 2/2] xfs: fix deadlock and " Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2020-10-05 18:21 [PATCH v2 0/2] xfs: a few fixes and cleanups to GETFSMAP Darrick J. Wong
2020-10-05 18:21 ` [PATCH 1/2] xfs: limit entries returned when counting fsmap records Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4857521.XMzPl6tNdl@garuda \
--to=chandanrlinux@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox