lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 14 Mar 2011 20:08:28 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





--- Comment #3 from Eugene A. Shatokhin <dame_eugene@...l.ru>  2011-03-14 20:08:27 ---
(In reply to comment #2)
> 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.

As far as I can see, it is not overkill. 

On the system where I observed the problem, 'i' began from 12
('num_meta_group_infos' was 12, the total number of groups to be initialized).
But only the first two elements of the sbi->s_group_info array were actually
initialized. So without setting the remaining pointers to NULL, 
    while (--i >= 0)
        kfree(sbi->s_group_info[i]);
would still result in an oops when it attempted to kfree()
sbi->s_group_info[11].

Apart from that, checking if the pointer is not NULL before kfree() could
probably be omitted in the patch as kfree(NULL) is a no-op anyway. But still,
it is a matter of coding style and personal preference.

-- 
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ