mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-11 22:08:03 +07:00
btrfs: filter invalid arg for btrfs resize
Originally following cmds will work: # btrfs fi resize -10A <mnt> # btrfs fi resize -10Gaha <mnt> Filter the arg by checking the return pointer of memparse. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
766b5e5ae7
commit
9a40f1222a
@ -1472,6 +1472,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
|
|||||||
struct btrfs_trans_handle *trans;
|
struct btrfs_trans_handle *trans;
|
||||||
struct btrfs_device *device = NULL;
|
struct btrfs_device *device = NULL;
|
||||||
char *sizestr;
|
char *sizestr;
|
||||||
|
char *retptr;
|
||||||
char *devstr = NULL;
|
char *devstr = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
@ -1539,8 +1540,8 @@ static noinline int btrfs_ioctl_resize(struct file *file,
|
|||||||
mod = 1;
|
mod = 1;
|
||||||
sizestr++;
|
sizestr++;
|
||||||
}
|
}
|
||||||
new_size = memparse(sizestr, NULL);
|
new_size = memparse(sizestr, &retptr);
|
||||||
if (new_size == 0) {
|
if (*retptr != '\0' || new_size == 0) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user