From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Sidong Yang <realwakka@gmail.com>,
linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH v2] btrfs-progs: common: make sure that qgroup id is in range
Date: Wed, 17 Mar 2021 09:51:23 +0800 [thread overview]
Message-ID: <87189d7e-a3ed-94fb-823d-4125ec3f922d@gmx.com> (raw)
In-Reply-To: <20210316132746.19979-1-realwakka@gmail.com>
On 2021/3/16 下午9:27, Sidong Yang wrote:
> When user assign qgroup with qgroup id that is too big to exceeds
> range and invade level value, and it works without any error. but
> this action would be make undefined error. this code make sure that
> qgroup id doesn't exceed range(0 ~ 2^48-1).
>
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> v2:
> Use btrfs_qgroup_level() for checking
> ---
> common/utils.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/common/utils.c b/common/utils.c
> index 57e41432..ba0bcb24 100644
> --- a/common/utils.c
> +++ b/common/utils.c
> @@ -727,6 +727,8 @@ u64 parse_qgroupid(const char *p)
> id = strtoull(p, &ptr_parse_end, 10);
> if (ptr_parse_end != ptr_src_end)
> goto path;
> + if (btrfs_qgroup_level(id))
> + goto err;
> return id;
> }
> level = strtoull(p, &ptr_parse_end, 10);
> @@ -734,6 +736,9 @@ u64 parse_qgroupid(const char *p)
> goto path;
>
> id = strtoull(s + 1, &ptr_parse_end, 10);
> + if (btrfs_qgroup_level(id))
> + goto err;
> +
> if (ptr_parse_end != ptr_src_end)
> goto path;
>
>
next prev parent reply other threads:[~2021-03-17 1:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 13:27 [PATCH v2] btrfs-progs: common: make sure that qgroup id is in range Sidong Yang
2021-03-17 1:51 ` Qu Wenruo [this message]
2021-03-17 18:36 ` David Sterba
2021-03-18 2:22 ` Sidong Yang
2021-03-18 2:35 ` Qu Wenruo
2021-03-18 20:34 ` David Sterba
2021-03-19 16:44 ` Sidong Yang
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=87189d7e-a3ed-94fb-823d-4125ec3f922d@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=realwakka@gmail.com \
/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