All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 30872] Calling kfree() for uninitialized pointer in ext4_mb_init_backend()
Date: Mon, 14 Mar 2011 14:23:31 GMT	[thread overview]
Message-ID: <201103141423.p2EENVBC005287@demeter1.kernel.org> (raw)
In-Reply-To: <bug-30872-13602@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=30872


Eric Sandeen <sandeen@redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandeen@redhat.com




--- Comment #2 from Eric Sandeen <sandeen@redhat.com>  2011-03-14 14:23:29 ---
(In reply to comment #1)

...

> > If ext4_mb_add_groupinfo() fails for some reason (e.g. if memory allocation at
> > line 2296 fails), ext4_mb_init_backend() tries to call kfree() for each
> > element in sbi->s_group_info array, including the ones that have not been
> > initialized yet:
> >
> > fs/ext4/mballoc.c:2414:
> > err_freebuddy:
> >    cachep = get_groupinfo_cache(sb->s_blocksize_bits);
> >    while (i-- > 0)
> >        kmem_cache_free(cachep, ext4_get_group_info(sb, i));
> >    i = num_meta_group_infos;
> >    while (i-- > 0)
> 
> literally understand, should be
> while (--i >= 0)
> 
> Could you try with above?

Hm, that probably is the most direct fix.

I sent a patch here:
http://marc.info/?l=linux-ext4&m=129979820301087&w=2
which initializes all the pointers to NULL and only frees if they are non-NULL, 
which may be more foolproof, but might also be overkill.

-Eric

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-03-14 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 14:21 [Bug 30872] New: Calling kfree() for uninitialized pointer in ext4_mb_init_backend() bugzilla-daemon
2011-03-14 10:07 ` Dave Young
2011-03-14 10:08 ` [Bug 30872] " bugzilla-daemon
2011-03-14 14:23 ` bugzilla-daemon [this message]
2011-03-14 20:08 ` bugzilla-daemon
2011-03-29  0:08 ` bugzilla-daemon
2011-04-11 21:11 ` bugzilla-daemon

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=201103141423.p2EENVBC005287@demeter1.kernel.org \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.