From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: [PATCH v2 0/2] KVM: Synchronize KVM devices list access and create ops Date: Tue, 9 Aug 2016 19:12:59 +0200 Message-ID: <20160809171301.24283-1-christoffer.dall@linaro.org> Cc: Andre Przywara , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Alexander Graf , borntraeger@de.ibm.com, paulus@ozlabs.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall To: kvm@vger.kernel.org Return-path: Received: from mail-wm0-f54.google.com ([74.125.82.54]:38813 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751865AbcHIRLR (ORCPT ); Tue, 9 Aug 2016 13:11:17 -0400 Received: by mail-wm0-f54.google.com with SMTP id o80so49081953wme.1 for ; Tue, 09 Aug 2016 10:11:17 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: Currently accesses the kvm->devices list is not synchronized by any mechanism which can potentially lead to data corruption. Further, a number of the create operations on the individual devices are racy and would allow creation of multiple devices, opposite to the intention. Factor out portions of the XICS create operation into a separate init operation and protect the remaining list accesses and create operations with the kvm->lock. Tested on arm/arm64 and compile-tested on powerpc for the xics changes. Tested-by on other archs would be appreciated. Christoffer Dall (2): KVM: PPC: Move xics_debugfs_init out of create KVM: Protect device ops->create and list_add with kvm->lock arch/arm/kvm/arm.c | 6 +++++- arch/powerpc/kvm/book3s_xics.c | 12 ++++++++---- include/linux/kvm_host.h | 12 ++++++++++++ virt/kvm/arm/vgic/vgic-init.c | 17 ++++------------- virt/kvm/kvm_main.c | 16 +++++++++++++++- 5 files changed, 44 insertions(+), 19 deletions(-) -- 2.9.0