[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201103141423.p2EENVBC005287@demeter1.kernel.org>
Date: Mon, 14 Mar 2011 14:23:31 GMT
From: bugzilla-daemon@...zilla.kernel.org
To: linux-ext4@...r.kernel.org
Subject: [Bug 30872] Calling kfree() for uninitialized pointer in
ext4_mb_init_backend()
https://bugzilla.kernel.org/show_bug.cgi?id=30872
Eric Sandeen <sandeen@...hat.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sandeen@...hat.com
--- Comment #2 from Eric Sandeen <sandeen@...hat.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists