xfs
[Top] [All Lists]

Re: [PATCH v2] xfsprogs: properly check size arguments for growfs

To: Guangyu Sun <guangyu.sun@xxxxxxxxxx>
Subject: Re: [PATCH v2] xfsprogs: properly check size arguments for growfs
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 18 Nov 2013 06:35:18 +1100
Cc: xfs@xxxxxxxxxxx, Koen De Wit <koen.de.wit@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1384459290-16291-1-git-send-email-guangyu.sun@xxxxxxxxxx>
References: <1384459290-16291-1-git-send-email-guangyu.sun@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Nov 14, 2013 at 12:01:30PM -0800, Guangyu Sun wrote:
> xfs_growfs has lowercase options to grow a filesystem as big as possible
> (e.g. the -d option) and uppercase options to grow a filesystem to a
> specified size, expressed in blocks. (e.g. the "-D size" option)
> 
> If the size parameter is not numerical, the parameter is either trimmed or
> ignored. In the latter case, the filesystem is grown as big as possible. This
> may happen when users accidentally specify the size in a format similar to
> mkfs.xfs (e.g. "-D 100m" or "-D size=16384")
> 
> In both cases, xfs_growfs should return an error instead of resizing the
> filesystem.
> 
> To reproduce:
>   # mkfs.xfs -f -d size=20m -L koenfs /dev/dm-3
>   # mount /dev/dm-3 //mnt
>   # xfs_growfs -D 10000andmorethan10invalidcharacters /mnt
>   (...)
>   data blocks changed from 5120 to 10000
>   # xfs_growfs -D invalidargument20000containingnumbers /mnt
>   (...)
>   data blocks changed from 10000 to 19659543
> 
> Reported-by: Koen De Wit <koen.de.wit@xxxxxxxxxx>
> Signed-off-by: Guangyu Sun <guangyu.sun@xxxxxxxxxx>

Perhaps this should be changed to use cvtnum() from libxcmd? That
will fix the input validation problem, and also allow xfs_growfs to
all the different methods of specifying size that we use elsewhere
in xfsprogs...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>