ext4: fix a double free in ext4_register_li_request
commit53224a1f02f493bb1a37bad94b596cc4314777e6
authorTao Ma <boyu.mt@taobao.com>
Mon, 4 Apr 2011 20:00:49 +0000 (4 16:00 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 20:02:40 +0000 (14 13:02 -0700)
treefa783e68aaa7146a0b302373fdb0944a8b2f51d4
parenta691a7c96629740253fc52c30460607b98e05328
ext4: fix a double free in ext4_register_li_request

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>
fs/ext4/super.c