Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-02-25 20:38:35 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-13 13:20:12 -0700
commit55f32f8ac693e2bb4081d7cec1144b0250182267 (patch)
treeb399e8fd346d0da5e98233a4b1f6d78ec314c1fb
parentf827e15f9ff7f653a3fff45487faf1460edd7705 (diff)
Btrfs: kfree correct pointer during mount option parsing
commit da495ecc0fb096b383754952a1c152147bc95b52 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: Andy Lutomirski <luto@mit.edu> Signed-off-by: Chris Mason <chris.mason@oracle.com> Acked-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-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 3f9b45704fcd..a649305b2059 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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;
}