From: Ted Ts'o <tytso@mit.edu>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>, dame_eugene@mail.ru
Subject: Re: [PATCH] ext4: don't kfree uninitialized s_group_info members
Date: Mon, 21 Mar 2011 21:27:05 -0400 [thread overview]
Message-ID: <20110322012705.GA3907@thunk.org> (raw)
In-Reply-To: <4D7958B3.8070309@redhat.com>
On Thu, Mar 10, 2011 at 05:03:15PM -0600, Eric Sandeen wrote:
> Per kernel.org bugzilla #30872 we may call kfree on uninitialized
> members of the s_group_info array. We can avoid this by kzalloc'ing
> the array, and only freeing them on the error path if they are
> non-zero.
>
> This doesn't entirely solve the oops on mount if we fail down this
> path; failed_mount4: frees the sbi, for one, which gets referenced
> later in the failed mount paths - I haven't worked that out yet.
>
> Reported-by: Eugene A. Shatokhin <dame_eugene@mail.ru>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Added to the ext4 patch tree, although I've dropped the second patch
hunk, since it's OK to call kfree on a NULL pointers:
> @@ -2412,7 +2412,8 @@ err_freebuddy:
> kmem_cache_free(cachep, ext4_get_group_info(sb, i));
> i = num_meta_group_infos;
> while (i-- > 0)
> - kfree(sbi->s_group_info[i]);
> + if (sbi->s_group_info[i])
> + kfree(sbi->s_group_info[i]);
> iput(sbi->s_buddy_cache);
> err_freesgi:
> kfree(sbi->s_group_info);
- Ted
prev parent reply other threads:[~2011-03-22 1:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-10 23:03 [PATCH] ext4: don't kfree uninitialized s_group_info members Eric Sandeen
2011-03-22 1:27 ` Ted Ts'o [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110322012705.GA3907@thunk.org \
--to=tytso@mit.edu \
--cc=dame_eugene@mail.ru \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).