[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP9B-QnCjz4UTALx0W4QA=7qTcEHTVOVid+kJW8Te-dgJoobHg@mail.gmail.com>
Date: Thu, 1 Jul 2021 23:37:33 +0800
From: Wang Shilong <wangshilong1991@...il.com>
To: Dave Chinner <david@...morbit.com>
Cc: linux-fsdevel@...r.kernel.org, linux-xfs@...r.kernel.org,
Ext4 Developers List <linux-ext4@...r.kernel.org>,
linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [PATCH v2] fs: forbid invalid project ID
On Tue, Jun 29, 2021 at 6:34 AM Dave Chinner <david@...morbit.com> wrote:
>
> 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@....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.
You are right, let me send a V3
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@...morbit.com
Powered by blists - more mailing lists