ext4: fix a double free in ext4_register_li_request
authorTao Ma <boyu.mt@taobao.com>
Mon, 4 Apr 2011 20:00:49 +0000 (16:00 -0400)
committerBrad Figg <brad.figg@canonical.com>
Wed, 27 Apr 2011 18:41:36 +0000 (11:41 -0700)
commitbb9c58c62e52c37a6fd30df02c84e6578079207b
treeeab3cfdbe60f4a9ba882ac2d6e02ed952096dd26
parent15ae7f334e3ead4130b370641c1992c90220f3c2
ext4: fix a double free in ext4_register_li_request

BugLink: http://bugs.launchpad.net/bugs/761134

commit 46e4690bbd9a4f8d9e7c4f34e34b48f703ad47e0 upstream.

In ext4_register_li_request, we malloc a ext4_li_request and
inserts it into ext4_li_info->li_request_list. In case of any
error later, we free it in the end.  But if we have some error
in ext4_run_lazyinit_thread, the whole li_request_list will be
dropped and freed in it. So we will double free this ext4_li_request.

This patch just sets elr to NULL after it is inserted to the list
so that the latter kfree won't double free it.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/ext4/super.c