diff options
author | Josef Bacik <josef@redhat.com> | 2010-02-25 15:38:35 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-03-08 16:26:50 -0500 |
commit | da495ecc0fb096b383754952a1c152147bc95b52 (patch) | |
tree | beec70bea515038c849c1b34836bba2455d90f2b /fs/btrfs/super.c | |
parent | 6bef4d317193d3badbbfa3f3c593758ace84a629 (diff) |
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.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) | |||
128 | { | 128 | { |
129 | struct btrfs_fs_info *info = root->fs_info; | 129 | struct btrfs_fs_info *info = root->fs_info; |
130 | substring_t args[MAX_OPT_ARGS]; | 130 | substring_t args[MAX_OPT_ARGS]; |
131 | char *p, *num; | 131 | char *p, *num, *orig; |
132 | int intarg; | 132 | int intarg; |
133 | int ret = 0; | 133 | int ret = 0; |
134 | 134 | ||
@@ -143,6 +143,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
143 | if (!options) | 143 | if (!options) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | 145 | ||
146 | orig = options; | ||
146 | 147 | ||
147 | while ((p = strsep(&options, ",")) != NULL) { | 148 | while ((p = strsep(&options, ",")) != NULL) { |
148 | int token; | 149 | int token; |
@@ -280,7 +281,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
280 | } | 281 | } |
281 | } | 282 | } |
282 | out: | 283 | out: |
283 | kfree(options); | 284 | kfree(orig); |
284 | return ret; | 285 | return ret; |
285 | } | 286 | } |
286 | 287 | ||