Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3690186ybv; Mon, 10 Feb 2020 04:46:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzrtYFj1S/8BlKc3uyfaC/5EPBY2hAa3uyNatitaj/heXXILAKf3Cj8OFLLKOWCx4FPwcxd X-Received: by 2002:a9d:7d9a:: with SMTP id j26mr867908otn.21.1581338787097; Mon, 10 Feb 2020 04:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338787; cv=none; d=google.com; s=arc-20160816; b=VHdYUIxlFfCwnYzg/AqUtxxDvC80E24Ru0jXpHVdAv3a0rJId11z1/qhR9FOnHrgDg Ypzho14gmk2N8SpsqxJhxzxpPcVPzw1qDVO1kvXoQf8t/1kEkOmF00KqO7W0vvlounre bhs5h+W0m9XMOFhRjvlYhWGcpVbnxXqC8vcWSmectK51Nqs6o9N1yW8Cv3b++7X9Wzdb 3u2BtgnQMRixM+UEdKMX1KmwrJ3ajpUPEVpjqXSA8khRP3GrZskGBnGcQy3+sek4k85C fgwjrystEDWR+UZbHcB3Uhxl7Um3V3GBSJ5Npykn3LHzsz7qWfbNWRGgftMdxAdU/XRY mv6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j3Ta0rKw0JkpnmwqC+NuIqMastud3kZHSBdzjwFk9lY=; b=PtQtpYBl3mXWA4YUZej9vkRFeVIfiP17P6d0XmTqntTCWszY8y1N2Yy3CWWbkRc+Bn 9OVoBUJAhGx7rhQQJBLRo9QLKA/G0ejjUns2uN5y2CgAQXp2yKUjUd7FMspUpC3e/2i0 Ra5J2XAhGxl7kWlWyYBCzCFXD4os8wHBucE+h6o9/Y/F7p9YB5JFMpPwf37FCUO8ucfE zhUFDwhi4SGT1M4TAaJG4j+wWevZhLtbL7vCLAZqakgxJPe9/ewdXXqusun0CKqMvlPm RFO1VzV/qUq77XcikP3BUz72DcF6smc1VHPSHmExBbFMbmEHJzRZwUJ+mMtft2j9DCAN 0M+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="O/H6K2Hn"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si133908otr.64.2020.02.10.04.46.15; Mon, 10 Feb 2020 04:46:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="O/H6K2Hn"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730504AbgBJMp4 (ORCPT + 99 others); Mon, 10 Feb 2020 07:45:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:43040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729639AbgBJMlO (ORCPT ); Mon, 10 Feb 2020 07:41:14 -0500 Received: from localhost (unknown [209.37.97.194]) (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 DA9FC21569; Mon, 10 Feb 2020 12:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338474; bh=ROBgPv5K8IOy3Rm+x9pw+cjWf2B51cdvq0ZBfwoVUJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/H6K2HnDMZs8TY6i6Gxk6c4WdvvZ+geSzd4q1xBTrBCyCqYGxPGjLyKiaLE4h1wl spZtnOPJ/jtNQAy0tu1G1rPqeUJl8nuYxm3gEzCAp1ewjWH/1Us2t1OPGAEz+1ZdXN lNz/YLqOSQU/AoC4siKfQHZNkLGrYO8ph1dwCtW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Kurz , Sean Christopherson , Paul Mackerras , Paolo Bonzini Subject: [PATCH 5.5 241/367] KVM: PPC: Book3S PR: Free shared page if mmu initialization fails Date: Mon, 10 Feb 2020 04:32:34 -0800 Message-Id: <20200210122446.425754469@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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 cb10bf9194f4d2c5d830eddca861f7ca0fecdbb4 upstream. Explicitly free the shared page if kvmppc_mmu_init() fails during kvmppc_core_vcpu_create(), as the page is freed only in kvmppc_core_vcpu_free(), which is not reached via kvm_vcpu_uninit(). Fixes: 96bc451a15329 ("KVM: PPC: Introduce shared page") Cc: stable@vger.kernel.org Reviewed-by: Greg Kurz Signed-off-by: Sean Christopherson Acked-by: Paul Mackerras Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_pr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -1806,10 +1806,12 @@ static struct kvm_vcpu *kvmppc_core_vcpu err = kvmppc_mmu_init(vcpu); if (err < 0) - goto uninit_vcpu; + goto free_shared_page; return vcpu; +free_shared_page: + free_page((unsigned long)vcpu->arch.shared); uninit_vcpu: kvm_vcpu_uninit(vcpu); free_shadow_vcpu: