Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5822103e authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Greg Kroah-Hartman
Browse files

KVM: x86: Cancel pvclock_gtod_work on module removal



commit 594b27e677b35f9734b1969d175ebc6146741109 upstream.

Nothing prevents the following:

  pvclock_gtod_notify()
    queue_work(system_long_wq, &pvclock_gtod_work);
  ...
  remove_module(kvm);
  ...
  work_queue_run()
    pvclock_gtod_work()	<- UAF

Ditto for any other operation on that workqueue list head which touches
pvclock_gtod_work after module removal.

Cancel the work in kvm_arch_exit() to prevent that.

Fixes: 16e8d74d ("KVM: x86: notifier for clocksource changes")
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Message-Id: <87czu4onry.ffs@nanos.tec.linutronix.de>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e4620fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6016,6 +6016,7 @@ void kvm_arch_exit(void)
	unregister_hotcpu_notifier(&kvmclock_cpu_notifier_block);
#ifdef CONFIG_X86_64
	pvclock_gtod_unregister_notifier(&pvclock_gtod_notifier);
	cancel_work_sync(&pvclock_gtod_work);
#endif
	kvm_x86_ops = NULL;
	kvm_mmu_module_exit();