[Bug 30872] Calling kfree() for uninitialized pointer in ext4_mb_init_backend()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


Eric Sandeen <sandeen@xxxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandeen@xxxxxxxxxx




--- Comment #2 from Eric Sandeen <sandeen@xxxxxxxxxx>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux