This is a note to let you know that I've just added the patch titled drm/i915/gvt: Get reference to KVM iff attachment to VM is successful to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-i915-gvt-get-reference-to-kvm-iff-attachment-to-vm-is-successful.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9ed1fdee9ee324f3505ff066287ee53143caaaa2 Mon Sep 17 00:00:00 2001 From: Sean Christopherson <seanjc@xxxxxxxxxx> Date: Fri, 11 Nov 2022 00:22:24 +0000 Subject: drm/i915/gvt: Get reference to KVM iff attachment to VM is successful From: Sean Christopherson <seanjc@xxxxxxxxxx> commit 9ed1fdee9ee324f3505ff066287ee53143caaaa2 upstream. Get a reference to KVM if and only if a vGPU is successfully attached to the VM to avoid leaking a reference if there's no available vGPU. On open_device() failure, vfio_device_open() doesn't invoke close_device(). Fixes: 421cfe6596f6 ("vfio: remove VFIO_GROUP_NOTIFY_SET_KVM") Cc: stable@xxxxxxxxxxxxxxx Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> Signed-off-by: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx> Link: http://patchwork.freedesktop.org/patch/msgid/20221111002225.2418386-2-seanjc@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/gvt/kvmgt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -765,8 +765,6 @@ static int intel_vgpu_open_device(struct return -ESRCH; } - kvm_get_kvm(vgpu->vfio_device.kvm); - if (__kvmgt_vgpu_exist(vgpu)) return -EEXIST; @@ -777,6 +775,7 @@ static int intel_vgpu_open_device(struct vgpu->track_node.track_write = kvmgt_page_track_write; vgpu->track_node.track_flush_slot = kvmgt_page_track_flush_slot; + kvm_get_kvm(vgpu->vfio_device.kvm); kvm_page_track_register_notifier(vgpu->vfio_device.kvm, &vgpu->track_node); Patches currently in stable-queue which might be from seanjc@xxxxxxxxxx are queue-6.0/kvm-x86-xen-validate-port-number-in-schedop_poll.patch queue-6.0/init-kconfig-fix-cc_has_asm_goto_tied_output-test-wi.patch queue-6.0/drm-i915-gvt-get-reference-to-kvm-iff-attachment-to-vm-is-successful.patch queue-6.0/kvm-x86-xen-only-do-in-kernel-acceleration-of-hypercalls-for-guest-cpl0.patch queue-6.0/kvm-update-gfn_to_pfn_cache-khva-when-it-moves-within-the-same-page.patch