From: Arkadiusz Miskiewicz <arekm@maven.pl>
To: xfs@oss.sgi.com
Subject: Re: [PATCH] Validate string -> number conversion.
Date: Wed, 25 Aug 2010 10:45:54 +0200 [thread overview]
Message-ID: <201008251045.54899.arekm@maven.pl> (raw)
In-Reply-To: <1282724556-19456-1-git-send-email-arekm@maven.pl>
On Wednesday 25 of August 2010, Arkadiusz Miśkiewicz wrote:
> Make sure that numbers passed as string will fit into proper
> types when doing string->uid_t/gid_t/prid_t conversion.
>
> Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
> ---
> libxcmd/input.c | 18 +++++++++++++++---
> quota/project.c | 2 +-
> 2 files changed, 16 insertions(+), 4 deletions(-)
On the kernel side something like below is needed (compile tested only).
The true fix is to extend on disk di_projid to 32bit (there is room for that).
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 237f5ff..1d9cf4f 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -906,6 +906,11 @@ xfs_ioctl_setattr(
if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO);
+ /* Make sure a userspace passed projid (32bit) will fit on disk (16bit) */
+ if (fa->fsx_projid > (__uint16_t)-1) {
+ code = XFS_ERROR(EINVAL);
+ goto error_return;
+ }
/*
* If disk quotas is on, we make sure that the dquots do exist on disk,
* before we start any other transactions. Trying to do this later
--
Arkadiusz Miśkiewicz PLD/Linux Team
arekm / maven.pl http://ftp.pld-linux.org/
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-08-25 8:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-25 8:22 [PATCH] Validate string -> number conversion Arkadiusz Miśkiewicz
2010-08-25 8:45 ` Arkadiusz Miskiewicz [this message]
2010-08-25 9:01 ` Arkadiusz Miskiewicz
2010-08-26 8:42 ` Dave Chinner
2010-08-27 22:31 ` [PATCH] xfstests: Quota project id setting overflow Arkadiusz Miśkiewicz
2010-08-26 7:30 ` [PATCH] Validate string -> number conversion Arkadiusz Miśkiewicz
2010-08-26 8:26 ` Dave Chinner
2010-08-27 20:54 ` [PATCH] Validate string -> number conversion. [version 3] Arkadiusz Miśkiewicz
2010-08-27 21:32 ` Alex Elder
2010-09-01 10:19 ` Christoph Hellwig
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=201008251045.54899.arekm@maven.pl \
--to=arekm@maven.pl \
--cc=xfs@oss.sgi.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