summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/page_track.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-03-27 18:53:50 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-03-28 15:08:02 +0300
commit2beb6dad2e8f95d710159d5befb390e4f62ab5cf (patch)
treede7330624e1508cc44fd21799cc689a7038c9a86 /arch/x86/kvm/page_track.c
parent7ad658b693536741c37b16aeb07840a2ce75f5b9 (diff)
downloadlinux-2beb6dad2e8f95d710159d5befb390e4f62ab5cf.tar.xz
KVM: x86: cleanup the page tracking SRCU instance
SRCU uses a delayed work item. Skip cleaning it up, and the result is use-after-free in the work item callbacks. Reported-by: Dmitry Vyukov <dvyukov@google.com> Suggested-by: Dmitry Vyukov <dvyukov@google.com> Cc: stable@vger.kernel.org Fixes: 0eb05bf290cfe8610d9680b49abef37febd1c38a Reviewed-by: Xiao Guangrong <xiaoguangrong.eric@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/page_track.c')
-rw-r--r--arch/x86/kvm/page_track.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/page_track.c b/arch/x86/kvm/page_track.c
index 37942e419c32..60168cdd0546 100644
--- a/arch/x86/kvm/page_track.c
+++ b/arch/x86/kvm/page_track.c
@@ -160,6 +160,14 @@ bool kvm_page_track_is_active(struct kvm_vcpu *vcpu, gfn_t gfn,
return !!ACCESS_ONCE(slot->arch.gfn_track[mode][index]);
}
+void kvm_page_track_cleanup(struct kvm *kvm)
+{
+ struct kvm_page_track_notifier_head *head;
+
+ head = &kvm->arch.track_notifier_head;
+ cleanup_srcu_struct(&head->track_srcu);
+}
+
void kvm_page_track_init(struct kvm *kvm)
{
struct kvm_page_track_notifier_head *head;