Btrfs: kfree correct pointer during mount option parsing
We kstrdup the options string, but then strsep screws with the pointer, so when we kfree() it, we're not giving it the right pointer. Tested-by: Andy Lutomirski <luto@mit.edu> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
6bef4d3171
commit
da495ecc0f
|
@ -128,7 +128,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *info = root->fs_info;
|
struct btrfs_fs_info *info = root->fs_info;
|
||||||
substring_t args[MAX_OPT_ARGS];
|
substring_t args[MAX_OPT_ARGS];
|
||||||
char *p, *num;
|
char *p, *num, *orig;
|
||||||
int intarg;
|
int intarg;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
|
||||||
if (!options)
|
if (!options)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
orig = options;
|
||||||
|
|
||||||
while ((p = strsep(&options, ",")) != NULL) {
|
while ((p = strsep(&options, ",")) != NULL) {
|
||||||
int token;
|
int token;
|
||||||
|
@ -280,7 +281,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
kfree(options);
|
kfree(orig);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue