]> git.karo-electronics.de Git - karo-tx-linux.git/commit
coredump: prevent double-free on an error path in core dumper
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 13 Sep 2012 01:01:27 +0000 (11:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 18 Sep 2012 06:04:46 +0000 (16:04 +1000)
commit20b6ded3ce44460113110466303a1fc62ded8140
tree8b8f3d111c16a1e036345662f2feac6824a9d0db
parentb6a3005b310cca245d38cf4f6eeae0046c34df98
coredump: prevent double-free on an error path in core dumper

In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
memory for info->fields, it frees already allocated stuff and returns
error to its caller, fill_note_info.  Which in turn returns error to its
caller, elf_core_dump.  Which jumps to cleanup label and calls
free_note_info, which will happily try to free all info->fields again.
BOOM.

This is the fix.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/binfmt_elf.c