]> git.karo-electronics.de Git - karo-tx-linux.git/commit
coredump: format_corename() can leak cn->corename
authorOleg Nesterov <oleg@redhat.com>
Wed, 19 Jun 2013 00:08:18 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:27:39 +0000 (17:27 +1000)
commitbecacb74d20c6326424cc912aa20cdcb751c942b
treea4e8ab7a0f152c7fde8418031aeee1933eb4d3dd
parentc63d61182a4d2653de3ac2c7233527dde7cf4453
coredump: format_corename() can leak cn->corename

do_coredump() assumes that format_corename() can only fail if
expand_corename() fails and frees cn->corename.  This is not true, for
example cn_print_exe_file() can fail and in this case nobody frees
cn->corename.

Change do_coredump() to always do kfree(cn->corename) after it calls
format_corename() (NULL is fine), change expand_corename() to do nothing
if kmalloc() fails.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Colin Walters <walters@verbum.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/coredump.c