From: Dave Chinner <david@fromorbit.com>
To: Wang Shilong <wangshilong1991@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] fs: forbid invalid project ID
Date: Tue, 29 Jun 2021 08:34:03 +1000 [thread overview]
Message-ID: <20210628223403.GE664593@dread.disaster.area> (raw)
In-Reply-To: <20210628123801.3511-1-wangshilong1991@gmail.com>
On Mon, Jun 28, 2021 at 08:38:01AM -0400, Wang Shilong wrote:
> fileattr_set_prepare() should check if project ID
> is valid, otherwise dqget() will return NULL for
> such project ID quota.
>
> Signed-off-by: Wang Shilong <wshilong@ddn.com>
> ---
> v1->v2: try to fix in the VFS
> ---
> fs/ioctl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 1e2204fa9963..5db5b218637b 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -845,6 +845,9 @@ static int fileattr_set_prepare(struct inode *inode,
> if (fa->fsx_cowextsize == 0)
> fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE;
>
> + if (!projid_valid(KPROJIDT_INIT(fa->fsx_projid)))
> + return -EINVAL;
This needs to go further up in this function in the section where
project IDs passed into this function are validated. Projids are
only allowed to be changed when current_user_ns() == &init_user_ns,
so this needs to be associated with that verification context.
This check should also use make_kprojid(), please, not open code
KPROJIDT_INIT.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2021-06-28 22:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 12:38 [PATCH v2] fs: forbid invalid project ID Wang Shilong
2021-06-28 22:34 ` Dave Chinner [this message]
2021-07-01 15:37 ` Wang Shilong
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=20210628223403.GE664593@dread.disaster.area \
--to=david@fromorbit.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=wangshilong1991@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