linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Shilong <wangshilong1991@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	linux-f2fs-devel@lists.sourceforge.net,
	Wang Shilong <wshilong@ddn.com>
Subject: Re: [PATCH v4] fs: forbid invalid project ID
Date: Thu, 22 Jul 2021 16:15:13 +0800	[thread overview]
Message-ID: <CAP9B-QnTvphddfafS310RD41Jc_tNM1Wvm34eWhZVe6VT5g3Kw@mail.gmail.com> (raw)
In-Reply-To: <20210710143959.58077-1-wangshilong1991@gmail.com>

Anyone take this patch to the tree? maybe Al Viro?

On Sat, Jul 10, 2021 at 10:40 PM Wang Shilong <wangshilong1991@gmail.com> wrote:
>
> From: Wang Shilong <wshilong@ddn.com>
>
> 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>
> ---
> v3->v3:
> only check project Id if caller is allowed
> to change and being changed.
>
> v2->v3: move check before @fsx_projid is accessed
> and use make_kprojid() helper.
>
> v1->v2: try to fix in the VFS
>  fs/ioctl.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 1e2204fa9963..d4fabb5421cd 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -817,6 +817,14 @@ static int fileattr_set_prepare(struct inode *inode,
>                 if ((old_ma->fsx_xflags ^ fa->fsx_xflags) &
>                                 FS_XFLAG_PROJINHERIT)
>                         return -EINVAL;
> +       } else {
> +               /*
> +                * Caller is allowed to change the project ID. If it is being
> +                * changed, make sure that the new value is valid.
> +                */
> +               if (old_ma->fsx_projid != fa->fsx_projid &&
> +                   !projid_valid(make_kprojid(&init_user_ns, fa->fsx_projid)))
> +                       return -EINVAL;
>         }
>
>         /* Check extent size hints. */
> --
> 2.27.0
>

      parent reply	other threads:[~2021-07-22  8:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 14:39 [PATCH v4] fs: forbid invalid project ID Wang Shilong
2021-07-13 17:19 ` Andreas Dilger
2021-07-14  4:16 ` Dave Chinner
2021-07-14  5:04 ` Darrick J. Wong
2021-07-22  8:15 ` Wang Shilong [this message]

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=CAP9B-QnTvphddfafS310RD41Jc_tNM1Wvm34eWhZVe6VT5g3Kw@mail.gmail.com \
    --to=wangshilong1991@gmail.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=wshilong@ddn.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;
as well as URLs for NNTP newsgroup(s).