[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb0375e11002251248h17f46468x9a5c3bab0e8bf60d@mail.gmail.com>
Date: Thu, 25 Feb 2010 15:48:21 -0500
From: Andrew Lutomirski <luto@....edu>
To: Josef Bacik <josef@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-btrfs@...r.kernel.org
Subject: Re: [2.6.33 regression] btrfs mount causes memory corruption
On Thu, Feb 25, 2010 at 3:38 PM, Josef Bacik <josef@...hat.com> wrote:
>
> Ok it looks like we have a problem kfree'ing the wrong stuff. 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. Please try this patch, and mount with -o
> acl and other such garbage to make sure it actually worked (acl isn't a valid
> mount option btw). Let me know if it works. Thanks,
>
> Josef
>
>
> 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;
> }
>
>
Thanks for the instant patch. I hammered on it a bit and it hasn't
crashed yet. I'll let you know if it crashes later. (The earlier
trial with xattr crashed after a couple minutes.)
In the mean time,
Tested-by: Andy Lutomirski <luto@....edu>
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists