diff options
author | Josef Bacik <josef@redhat.com> | 2010-02-25 20:38:35 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-21 12:44:14 -0700 |
commit | 171d73b2f89f57d6696d0aaf42fd5ff8ae19801f (patch) | |
tree | 41a5e63656fd61b6897bd3c1fed3217be0d758bd /fs | |
parent | 3eb88cf70fd483e2333b1954e35b355deb5e1f06 (diff) | |
download | linux-rt-171d73b2f89f57d6696d0aaf42fd5ff8ae19801f.tar.gz |
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/super.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 8a1ea6e64575..f8b4521de907 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; } |