• Changbin Du's avatar
    drm/i915/kvmgt: fix suspicious rcu dereference usage · 5180edc2
    Changbin Du authored
    The srcu read lock must be held while accessing kvm memslots.
    This patch fix below warning for function kvmgt_rw_gpa().
    
    [  165.345093] [ ERR: suspicious RCU usage.  ]
    [  165.416538] Call Trace:
    [  165.418989]  dump_stack+0x85/0xc2
    [  165.422310]  lockdep_rcu_suspicious+0xd7/0x110
    [  165.426769]  kvm_read_guest_page+0x195/0x1b0 [kvm]
    [  165.431574]  kvm_read_guest+0x50/0x90 [kvm]
    [  165.440492]  kvmgt_rw_gpa+0x43/0xa0 [kvmgt]
    [  165.444683]  kvmgt_read_gpa+0x11/0x20 [kvmgt]
    [  165.449061]  gtt_get_entry64+0x4d/0xc0 [i915]
    [  165.453438]  ppgtt_populate_shadow_page_by_guest_entry+0x380/0xdc0 [i915]
    [  165.460254]  shadow_mm+0xd1/0x460 [i915]
    [  165.472488]  intel_vgpu_create_mm+0x1ab/0x210 [i915]
    [  165.477472]  intel_vgpu_g2v_create_ppgtt_mm+0x5f/0xc0 [i915]
    [  165.483154]  pvinfo_mmio_write+0x19b/0x1d0 [i915]
    [  165.499068]  intel_vgpu_emulate_mmio_write+0x3f9/0x600 [i915]
    [  165.504827]  intel_vgpu_rw+0x114/0x150 [kvmgt]
    [  165.509281]  intel_vgpu_write+0x16f/0x1a0 [kvmgt]
    [  165.513993]  vfio_mdev_write+0x20/0x30 [vfio_mdev]
    [  165.518793]  vfio_device_fops_write+0x24/0x30 [vfio]
    [  165.523770]  __vfs_write+0x28/0x120
    [  165.540529]  vfs_write+0xce/0x1f0
    
    v2: fix Cc format for stable
    Signed-off-by: default avatarChangbin Du <changbin.du@intel.com>
    Cc: <stable@vger.kernel.org> # v4.10+
    Reviewed-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
    Reviewed-by: default avatarJike Song <jike.song@intel.com>
    Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
    5180edc2
kvmgt.c 34.1 KB