diff options
author | Greg Kurz <groug@kaod.org> | 2017-09-14 23:56:25 +0200 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2017-10-14 11:32:53 +1100 |
commit | ac64115a66c18c01745bbd3c47a36b124e5fd8c0 (patch) | |
tree | b58e717d09ba7479189c8ee37f8d819f38348f51 /tools/perf/util/demangle-java.c | |
parent | 8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff) |
KVM: PPC: Fix oops when checking KVM_CAP_PPC_HTM
The following program causes a kernel oops:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/kvm.h>
main()
{
int fd = open("/dev/kvm", O_RDWR);
ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_PPC_HTM);
}
This happens because when using the global KVM fd with
KVM_CHECK_EXTENSION, kvm_vm_ioctl_check_extension() gets
called with a NULL kvm argument, which gets dereferenced
in is_kvmppc_hv_enabled(). Spotted while reading the code.
Let's use the hv_enabled fallback variable, like everywhere
else in this function.
Fixes: 23528bb21ee2 ("KVM: PPC: Introduce KVM_CAP_PPC_HTM")
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'tools/perf/util/demangle-java.c')
0 files changed, 0 insertions, 0 deletions