Commit 6d15ee49 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm NULL deref fix from Gleb Natapov.

* git://git.kernel.org/pub/scm/virt/kvm/kvm:
  Fix NULL dereference in gfn_to_hva_prot()
parents afe05d41 a2ac07fe
...@@ -1064,10 +1064,12 @@ EXPORT_SYMBOL_GPL(gfn_to_hva); ...@@ -1064,10 +1064,12 @@ EXPORT_SYMBOL_GPL(gfn_to_hva);
unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable) unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable)
{ {
struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn);
if (writable) unsigned long hva = __gfn_to_hva_many(slot, gfn, NULL, false);
if (!kvm_is_error_hva(hva) && writable)
*writable = !memslot_is_readonly(slot); *writable = !memslot_is_readonly(slot);
return __gfn_to_hva_many(gfn_to_memslot(kvm, gfn), gfn, NULL, false); return hva;
} }
static int kvm_read_hva(void *data, void __user *hva, int len) static int kvm_read_hva(void *data, void __user *hva, int len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment