From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05CADC2BA83 for ; Thu, 13 Feb 2020 15:43:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5ADD20675 for ; Thu, 13 Feb 2020 15:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581608624; bh=b0FOauxgLNMEy1wQ+wzaA8xcGscBzKC+R+e0FgSdLPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jw6dRqGsqF0EviuuP1q+A5ZiRMkgRRR8PNKehrhXfKFcjI/GoKu+DgPsyiKD1zJEO bYF+EpmBx4ahsuyNOmLlur/WTnAazvbQ3BIn8V7h/UijwoZrp1eevbQ06aDZZk8wvl GH2EYVO+M+9ba58dg1v4jzUGzkDSIcDnipI5qujw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbgBMP1v (ORCPT ); Thu, 13 Feb 2020 10:27:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387472AbgBMPZg (ORCPT ); Thu, 13 Feb 2020 10:25:36 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A0D524693; Thu, 13 Feb 2020 15:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607534; bh=b0FOauxgLNMEy1wQ+wzaA8xcGscBzKC+R+e0FgSdLPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i6YPJl4QRNpeR5kTvGNqCIu6BdL8Dptvc+gLiqxeRt/McOMWtBcDtSMLuF0YMziXQ 3dN+SNW+JpMrsEa59g6XsHN2+WO9uiG5YCy1pUrbvQLx84mMhwKCCb8U47YLg4hicQ Kw5FB7sAdNJlnY1CxO18/RWUu81bTX/dMAjLfzWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 4.14 091/173] KVM: x86: Free wbinvd_dirty_mask if vCPU creation fails Date: Thu, 13 Feb 2020 07:19:54 -0800 Message-Id: <20200213151956.021088390@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151931.677980430@linuxfoundation.org> References: <20200213151931.677980430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 16be9ddea268ad841457a59109963fff8c9de38d upstream. Free the vCPU's wbinvd_dirty_mask if vCPU creation fails after kvm_arch_vcpu_init(), e.g. when installing the vCPU's file descriptor. Do the freeing by calling kvm_arch_vcpu_free() instead of open coding the freeing. This adds a likely superfluous, but ultimately harmless, call to kvmclock_reset(), which only clears vcpu->arch.pv_time_enabled. Using kvm_arch_vcpu_free() allows for additional cleanup in the future. Fixes: f5f48ee15c2ee ("KVM: VMX: Execute WBINVD to keep data consistency with assigned devices") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8063,7 +8063,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vc kvm_mmu_unload(vcpu); vcpu_put(vcpu); - kvm_x86_ops->vcpu_free(vcpu); + kvm_arch_vcpu_free(vcpu); } void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)