]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: fix wbinvd_dirty_mask use-after-free
authorIdo Yariv <ido@wizery.com>
Fri, 21 Oct 2016 16:39:57 +0000 (12:39 -0400)
committerJiri Slaby <jslaby@suse.cz>
Thu, 24 Nov 2016 15:23:24 +0000 (16:23 +0100)
commit5a0561dff3f260364619f999693a5d305bf0e831
tree44306593a33fd6fcae8881e3ddf0d3e3dd3347d8
parent1dc4edef2413dffc53c452f3ba5bd34d71a8eb88
KVM: x86: fix wbinvd_dirty_mask use-after-free

commit bd768e146624cbec7122ed15dead8daa137d909d upstream.

vcpu->arch.wbinvd_dirty_mask may still be used after freeing it,
corrupting memory. For example, the following call trace may set a bit
in an already freed cpu mask:
    kvm_arch_vcpu_load
    vcpu_load
    vmx_free_vcpu_nested
    vmx_free_vcpu
    kvm_arch_vcpu_free

Fix this by deferring freeing of wbinvd_dirty_mask.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/x86/kvm/x86.c