Commit 55f32f8a authored by Josef Bacik's avatar Josef Bacik Committed by Greg Kroah-Hartman

Btrfs: kfree correct pointer during mount option parsing

commit da495ecc upstream.

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: default avatarAndy Lutomirski <luto@mit.edu>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
Acked-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f827e15f
......@@ -126,7 +126,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
{
struct btrfs_fs_info *info = root->fs_info;
substring_t args[MAX_OPT_ARGS];
char *p, *num;
char *p, *num, *orig;
int intarg;
int ret = 0;
......@@ -141,6 +141,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
if (!options)
return -ENOMEM;
orig = options;
while ((p = strsep(&options, ",")) != NULL) {
int token;
......@@ -273,7 +274,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
}
}
out:
kfree(options);
kfree(orig);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment