]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
perf record: Fix failed memory allocation for get_cpuid_str
authorThomas Richter <tmricht@linux.vnet.ibm.com>
Wed, 17 Jan 2018 13:16:11 +0000 (14:16 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 17:44:25 +0000 (13:44 -0400)
commit955313976bede6a9cd93bb48dddcc97774a3e644
treef5241182664ff11c8b8a1c9597203e15111f23b7
parentd620977ced8aadc537d21065e20561aa25eddf13
perf record: Fix failed memory allocation for get_cpuid_str

BugLink: http://bugs.launchpad.net/bugs/1774063
[ Upstream commit 81fccd6ca507d3b2012eaf1edeb9b1dbf4bd22db ]

In x86 architecture dependend part function get_cpuid_str() mallocs a
128 byte buffer, but does not check if the memory allocation succeeded
or not.

When the memory allocation fails, function __get_cpuid() is called with
first parameter being a NULL pointer.  However this function references
its first parameter and operates on a NULL pointer which might cause
core dumps.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180117131611.34319-1-tmricht@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
tools/perf/arch/x86/util/header.c