From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ABCDC07E9A for ; Wed, 14 Jul 2021 05:04:55 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C96661279; Wed, 14 Jul 2021 05:04:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C96661279 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1m3X4o-00050V-Lk; Wed, 14 Jul 2021 05:04:54 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1m3X4n-00050N-3z for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Jul 2021 05:04:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ep25NXGaKy7iLmv/hLzAs5+NAintJ3fq7jB/7+yc6ZY=; b=I1d14qKQTCIxIM3JIU3TfssOUd +CdavaU/B/NE5gwRzdbUEPXjsVzcZWWpF0NrpaxwTcrPAmk9jIQInFvRYymP6Y/UgTG7X0pFmcWJU /ax25kJ2FdOo0JvU4MF/l5rBhLrYWrMtnYNuWtZlQmXUbwSOwxnCZMK68OVnMWVs1wow=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ep25NXGaKy7iLmv/hLzAs5+NAintJ3fq7jB/7+yc6ZY=; b=GfYzfao2pWbo9hGd0BFYm+nGG9 ftJ5/ITVU83DszQMka+kOyasKNindq+c3l2h15tgTMOJjuLCeiLZDY5+mP8//fbVGRFPbvFAvPGwB dj5ykw6jeySXqg50PKNEmVSsaEx35QZUh24iITI0CvVFoMO1azLwzMdeDWRlnPe8XYKc=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1m3X4h-007fFM-AD for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Jul 2021 05:04:53 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 016B960FD8; Wed, 14 Jul 2021 05:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626239077; bh=Jc1sNtDQLolCUqZGQica4040YhI273wmJsvNWUazVMU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UWnd/YzekvcZgciRPDO2VDGc5jefYAa1w8p3Vjj4SV7C/lPk0nz0bWt6/xjz0r+LN /vsMehsZND0VXQBUpUt+yqOmVnh0nJnnv+5jeOHtFoErWyN5uO26GhuWQGXnZYFNtx rZxXFverfex9HCcHFguzDqBLrC7mc41WwHaKY51njN+ELp1nH80BNjSPGnY7xW1Wh8 WXJ/XCZ0IShzVBu2YPhe/z0Ytdvm3PViCRMF7DWftS9pUMgBxyyzamzDc1wq5GelGt I8To5FlidFdvSjJH5ie48P6mPDmR8ggS4bVkzvnSXWnzw4y1TT5TD1a3/A5cRrodnt 8Gl0faYQvuXbQ== Date: Tue, 13 Jul 2021 22:04:36 -0700 From: "Darrick J. Wong" To: Wang Shilong Message-ID: <20210714050436.GH22402@magnolia> References: <20210710143959.58077-1-wangshilong1991@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210710143959.58077-1-wangshilong1991@gmail.com> X-Headers-End: 1m3X4h-007fFM-AD Subject: Re: [f2fs-dev] [PATCH v4] fs: forbid invalid project ID X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, Wang Shilong , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Sat, Jul 10, 2021 at 10:39:59PM +0800, Wang Shilong wrote: > From: Wang Shilong > > 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 > --- > 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; Hmm, for XFS this is sort of a userspace-breaking change in the sense that (technically) we've never rejected -1 before. xfs_quota won't have anything to do with that, and (assuming I read the helper/macro gooeyness correctly) the vfs quota code won't either, so Reviewed-by: Darrick J. Wong --D > } > > /* Check extent size hints. */ > -- > 2.27.0 > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel