]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
drm/i915/kvmgt: Hold struct kvm reference
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 20 Mar 2017 02:38:40 +0000 (20:38 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:11:44 +0000 (10:11 +0200)
commit691f5a3510ba83d25806f8eefa3b0d642d498dd5
treeb6e05a358cfb4cb7fd98cca98f78df5073a19ef8
parent468855d90a8e11d9a1b60ab4c746f4d2486d1f97
drm/i915/kvmgt: Hold struct kvm reference

BugLink: http://bugs.launchpad.net/bugs/1681875
commit 93a15b58cfb8a24e666ffca432f19fe65c1cd7d1 upstream.

The kvmgt code keeps a pointer to the struct kvm associated with the
device, but doesn't actually hold a reference to it.  If we do unclean
shutdown testing (ie. killing the user process), then we can see the
kvm association to the device unset, which causes kvmgt to trigger a
device release via a work queue.  Naturally we cannot guarantee that
the cached struct kvm pointer is still valid at this point without
holding a reference.  The observed failure in this case is a stuck
cpu trying to acquire the spinlock from the invalid reference, but
other failure modes are clearly possible.  Hold a reference to avoid
this.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Jike Song <jike.song@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Reviewed-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/gpu/drm/i915/gvt/kvmgt.c