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

Dave Chinner david at fromorbit.com
Sun Nov 17 13:35:18 CST 2013


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 at oracle.com>
> Signed-off-by: Guangyu Sun <guangyu.sun at oracle.com>

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 at fromorbit.com



More information about the xfs mailing list