From: Wang Shilong <wangshilong1991@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
wangshilong1991@gmail.com
Subject: [PATCH v2] fs: forbid invalid project ID
Date: Mon, 28 Jun 2021 08:38:01 -0400 [thread overview]
Message-ID: <20210628123801.3511-1-wangshilong1991@gmail.com> (raw)
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;
+
return 0;
}
--
2.27.0
next reply other threads:[~2021-06-28 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 12:38 Wang Shilong [this message]
2021-06-28 22:34 ` [PATCH v2] fs: forbid invalid project ID Dave Chinner
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=20210628123801.3511-1-wangshilong1991@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 \
/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