linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Changbin Du <changbin.du@intel.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	Jike Song <jike.song@intel.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>
Subject: [PATCH 4.10 062/110] drm/i915/kvmgt: fix suspicious rcu dereference usage
Date: Mon, 10 Apr 2017 18:42:53 +0200	[thread overview]
Message-ID: <20170410164204.683822582@linuxfoundation.org> (raw)
In-Reply-To: <20170410164201.247583164@linuxfoundation.org>

4.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Changbin Du <changbin.du@intel.com>

commit 5180edc2421117766fcb9c2d2dc6bfaeefdeb709 upstream.

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: Changbin Du <changbin.du@intel.com>
Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.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>

---
 drivers/gpu/drm/i915/gvt/kvmgt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1422,7 +1422,7 @@ static int kvmgt_rw_gpa(unsigned long ha
 {
 	struct kvmgt_guest_info *info;
 	struct kvm *kvm;
-	int ret;
+	int idx, ret;
 	bool kthread = current->mm == NULL;
 
 	if (!handle_valid(handle))
@@ -1434,8 +1434,10 @@ static int kvmgt_rw_gpa(unsigned long ha
 	if (kthread)
 		use_mm(kvm->mm);
 
+	idx = srcu_read_lock(&kvm->srcu);
 	ret = write ? kvm_write_guest(kvm, gpa, buf, len) :
 		      kvm_read_guest(kvm, gpa, buf, len);
+	srcu_read_unlock(&kvm->srcu, idx);
 
 	if (kthread)
 		unuse_mm(kvm->mm);

  parent reply	other threads:[~2017-04-10 16:52 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 16:41 [PATCH 4.10 000/110] 4.10.10-stable review Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 001/110] drm/vmwgfx: Type-check lookups of fence objects Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 002/110] drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl() Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 003/110] drm/vmwgfx: avoid calling vzalloc with a 0 size in vmw_get_cap_3d_ioctl() Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 004/110] drm/ttm, drm/vmwgfx: Relax permission checking when opening surfaces Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 005/110] drm/vmwgfx: Remove getparam error message Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 006/110] drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl() Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 007/110] PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller Greg Kroah-Hartman
2017-04-10 16:41 ` [PATCH 4.10 008/110] PCI: thunder-pem: Fix legacy firmware PEM-specific resources Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 009/110] sysfs: be careful of error returns from ops->show() Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 010/110] staging: android: ashmem: lseek failed due to no FMODE_LSEEK Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 011/110] arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 012/110] arm/arm64: KVM: Take mmap_sem in kvm_arch_prepare_memory_region Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 013/110] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 014/110] iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 015/110] iio: st_pressure: initialize lps22hb bootime Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 016/110] iio: bmg160: reset chip when probing Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 017/110] arm64: mm: unaligned access by user-land should be received as SIGBUS Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 018/110] cfg80211: check rdev resume callback only for registered wiphy Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 019/110] Reset TreeId to zero on SMB2 TREE_CONNECT Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 020/110] mm/page_alloc.c: fix print order in show_free_areas() Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 021/110] ptrace: fix PTRACE_LISTEN race corrupting task->state Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 022/110] dax: fix radix tree insertion race Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 023/110] dm verity fec: limit error correction recursion Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 024/110] dm verity fec: fix bufio leaks Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 025/110] ACPI / gpio: do not fall back to parsing _CRS when we get a deferral Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 026/110] ACPI / scan: Prefer devices without _HID for _ADR matching Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 027/110] Kbuild: use cc-disable-warning consistently for maybe-uninitialized Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 028/110] jump label: fix passing kbuild_cflags when checking for asm goto support Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 029/110] orangefs: move features validation to fix filesystem hang Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 030/110] xfs: Honor FALLOC_FL_KEEP_SIZE when punching ends of files Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 031/110] ring-buffer: Fix return value check in test_ringbuffer() Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 032/110] mac80211: unconditionally start new netdev queues with iTXQ support Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 033/110] brcmfmac: use local iftype avoiding use-after-free of virtual interface Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 034/110] metag/usercopy: Drop unused macros Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 035/110] metag/usercopy: Fix alignment error checking Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 036/110] metag/usercopy: Add early abort to copy_to_user Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 037/110] metag/usercopy: Zero rest of buffer from copy_from_user Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 038/110] metag/usercopy: Set flags before ADDZ Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 039/110] metag/usercopy: Fix src fixup in from user rapf loops Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 040/110] metag/usercopy: Add missing fixups Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 041/110] drm/msm: adreno: fix build error without debugfs Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 042/110] powerpc: Disable HFSCR[TM] if TM is not supported Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 043/110] powerpc/mm: Add missing global TLB invalidate if cxl is active Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 044/110] powerpc/64: Fix flush_(d|i)cache_range() called from modules Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 045/110] powerpc: Dont try to fix up misaligned load-with-reservation instructions Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 046/110] powerpc/crypto/crc32c-vpmsum: Fix missing preempt_disable() Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 048/110] x86/mce: Dont print MCEs when mcelog is active Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 049/110] nios2: reserve boot memory for device tree Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 050/110] xtensa: make __pa work with uncached KSEG addresses Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 051/110] s390/decompressor: fix initrd corruption caused by bss clear Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 052/110] s390/uaccess: get_user() should zero on failure (again) Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 053/110] MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 054/110] MIPS: ralink: Fix typos in rt3883 pinctrl Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 055/110] MIPS: End spinlocks with .insn Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 056/110] MIPS: Lantiq: fix missing xbar kernel panic Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 057/110] MIPS: Check TLB before handle_ri_rdhwr() for Loongson-3 Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 058/110] MIPS: Add MIPS_CPU_FTLB for Loongson-3A R2 Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 059/110] MIPS: Flush wrong invalid FTLB entry for huge page Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 060/110] MIPS: c-r4k: Fix Loongson-3s vcache/scache waysize calculation Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 061/110] drm/i915/gvt: Fix gvt scheduler interval time Greg Kroah-Hartman
2017-04-10 16:42 ` Greg Kroah-Hartman [this message]
2017-04-10 16:42 ` [PATCH 4.10 063/110] usb: dwc3: gadget: delay unmap of bounced requests Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 064/110] Documentation: stable-kernel-rules: fix stable-tag format Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 065/110] mm/mempolicy.c: fix error handling in set_mempolicy and mbind Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 066/110] random: use chacha20 for get_random_int/long Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 067/110] kvm: fix page struct leak in handle_vmon Greg Kroah-Hartman
2017-04-10 16:42 ` [PATCH 4.10 068/110] HID: multitouch: enable the Surface 4 Type Cover Pro (JP) to report multitouch data Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 069/110] drm/edid: constify edid quirk list Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 070/110] drm/i915: fix INTEL_BDW_IDS definition Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 071/110] drm/i915: more .is_mobile cleanups for BDW Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 072/110] drm/i915: actually drive the BDW reserved IDs Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 073/110] ASoC: Intel: bytcr_rt5640: quirks for Insyde devices Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 074/110] ARM: OMAP2+: Fix init for multiple quirks for the same SoC Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 075/110] usb: chipidea: msm: Rely on core to override AHBBURST Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 076/110] serial: 8250_omap: Add OMAP_DMA_TX_KICK quirk for AM437x Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 077/110] ARM: davinci: add skeleton for pdata-quirks Greg Kroah-Hartman
2017-04-11  8:13   ` Sekhar Nori
2017-04-11 14:41     ` Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 079/110] usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 080/110] usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 081/110] drm/mga: remove device_is_agp callback Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 082/110] PCI: Add ACS quirk for Intel Union Point Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 083/110] PCI: xgene: Fix double free on init error Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 084/110] [media] rx51: broken build Greg Kroah-Hartman
2017-04-11 11:44   ` Sean Young
2017-04-11 14:42     ` Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 085/110] sata: ahci-da850: implement a workaround for the softreset quirk Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 086/110] ACPI / button: Change default behavior to lid_init_state=open Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 087/110] ASoC: codecs: rt5670: add quirk for Lenovo Thinkpad 10 Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 088/110] ASoC: Intel: Baytrail: " Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 089/110] ASoC: Intel: cht_bsw_rt5645: harden ACPI device detection Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 090/110] ASoC: Intel: cht_bsw_rt5645: add Baytrail MCLK support Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 091/110] ACPI: save NVS memory for Lenovo G50-45 Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 092/110] usb: musb: da8xx: Fix host mode suspend Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 094/110] HID: wacom: dont apply generic settings to old devices Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 095/110] arm: kernel: Add SMC structure parameter Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 096/110] firmware: qcom: scm: Fix interrupted SCM calls Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 097/110] ARM: smccc: Update HVC comment to describe new quirk parameter Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 098/110] PCI: Add Broadcom Northstar2 PAXC quirk for device class and MPSS Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 099/110] PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 100/110] mmc: sdhci-of-esdhc: remove default broken-cd for ARM Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 101/110] PCI: Sort the list of devices with D3 delay quirk by ID Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 102/110] PCI: Add ACS quirk for Qualcomm QDF2400 and QDF2432 Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 103/110] watchdog: s3c2410: Fix infinite interrupt in soft mode Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 105/110] tools/power turbostat: decode Baytrail CC6 and MC6 demotion configuration Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 106/110] tools/power turbostat: dump Atom P-states correctly Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 107/110] x86/reboot/quirks: Add ASUS EeeBook X205TA reboot quirk Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 108/110] x86/reboot/quirks: Add ASUS EeeBook X205TA/W " Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 109/110] usb-storage: Add ignore-residue quirk for Initio INIC-3619 Greg Kroah-Hartman
2017-04-10 16:43 ` [PATCH 4.10 110/110] x86/reboot/quirks: Fix typo in ASUS EeeBook X205TA reboot quirk Greg Kroah-Hartman
2017-04-10 20:39 ` [PATCH 4.10 000/110] 4.10.10-stable review Shuah Khan
2017-04-11  4:58   ` Greg Kroah-Hartman
2017-04-11  3:17 ` Guenter Roeck
2017-04-11  4:48   ` Greg Kroah-Hartman
2017-04-11  5:04     ` Guenter Roeck
2017-04-11  5:02 ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170410164204.683822582@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=changbin.du@intel.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=jike.song@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zhenyuw@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).