summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-02-25 20:38:35 +0000
committerChris Mason <chris.mason@oracle.com>2010-03-08 16:26:50 -0500
commitda495ecc0fb096b383754952a1c152147bc95b52 (patch)
treebeec70bea515038c849c1b34836bba2455d90f2b /fs/btrfs/super.c
parent6bef4d317193d3badbbfa3f3c593758ace84a629 (diff)
downloadop-kernel-dev-da495ecc0fb096b383754952a1c152147bc95b52.zip
op-kernel-dev-da495ecc0fb096b383754952a1c152147bc95b52.tar.gz
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>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 8a1ea6e..f8b4521 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -128,7 +128,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;
@@ -143,6 +143,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
if (!options)
return -ENOMEM;
+ orig = options;
while ((p = strsep(&options, ",")) != NULL) {
int token;
@@ -280,7 +281,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
}
}
out:
- kfree(options);
+ kfree(orig);
return ret;
}
OpenPOWER on IntegriCloud