From patchwork Tue Mar 1 23:51:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8476441 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95C3CC0553 for ; Wed, 2 Mar 2016 02:06:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1EC12010F for ; Wed, 2 Mar 2016 02:06:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA39320122 for ; Wed, 2 Mar 2016 02:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754330AbcCAXvQ (ORCPT ); Tue, 1 Mar 2016 18:51:16 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:42851 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754302AbcCAXvO (ORCPT ); Tue, 1 Mar 2016 18:51:14 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; s=mandrill; d=linuxfoundation.org; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=gregkh@linuxfoundation.org; bh=a6JOuHTAvqeZSDnVoMOhvNDrs/Q=; b=fsxYO8Otrj1Rs9h+q8sQlkPJDDpmVlsLivDOFTp4tmRigY5VQJPd9kS7bTj4Fj/2MCzKqCg/2z8E ZzwcU+hUNQ0GKTrQCd+H6q2RxKxOgWXWEH2trmoaQJyqB2w48lRVbBFmE6cIgIzi7+XYfLEQRb5D PBu29dOsxMhfIylTXPk= DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=NwNM4ED/UCMrgqy/BEtKz/WxSubvz+LcNbKM3r3D6Dn3TTwkDqU1OI3Tjn624Z4mMH+BhOzbZOdM zI3epJIeWaCIl/ToXlIHl8ZWrj5/tVpg2oHWjTolluSPCmIcDX76a22d6J8uaA1svFMqrAWtg1/u b0rJAhPOnQK+vAQKsvw=; Received: from pmta03.dal05.mailchimp.com (127.0.0.1) by mail333.us4.mandrillapp.com id hqolf4174no0 for ; Tue, 1 Mar 2016 23:51:02 +0000 (envelope-from ) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1456876262; h=From : Subject : To : Cc : Message-Id : In-Reply-To : References : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=XY0EhdYGs8GP7Um/K6KgP4RY/1mmfuN/o33bPgYN+pc=; b=X0Z0iqAN4t2GtE4E5yPMHeb6zxcB4eYupuw5DBEwbN5zNDxZUCA64hgJvaVMaEONj1dUzp RDrb9UyO1v3jkzFljxinX+zrLi81W/Tr6pICo2xoCdEJk1F6EtiAVymVVqKruShWuGFlelqh bamOtIW9F8NacWc5nx8FrBACJnVBc= From: Greg Kroah-Hartman Subject: [PATCH 3.14 035/130] MIPS: KVM: Uninit VCPU in vcpu_create error path Received: from [50.170.35.168] by mandrillapp.com id 7a4e79e7595145f892d620859bf9cc04; Tue, 01 Mar 2016 23:51:02 +0000 X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , James Hogan , Ralf Baechle , Paolo Bonzini , Gleb Natapov , , Message-Id: <20160301234500.991724417@linuxfoundation.org> In-Reply-To: <20160301234459.768886030@linuxfoundation.org> References: <20160301234459.768886030@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.7a4e79e7595145f892d620859bf9cc04 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:51:02 +0000 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY, URIBL_GREY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Hogan commit 585bb8f9a5e592f2ce7abbe5ed3112d5438d2754 upstream. If either of the memory allocations in kvm_arch_vcpu_create() fail, the vcpu which has been allocated and kvm_vcpu_init'd doesn't get uninit'd in the error handling path. Add a call to kvm_vcpu_uninit() to fix this. Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM") Signed-off-by: James Hogan Cc: Ralf Baechle Cc: Paolo Bonzini Cc: Gleb Natapov Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: James Hogan Signed-off-by: Greg Kroah-Hartman --- arch/mips/kvm/kvm_mips.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -313,7 +313,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st if (!gebase) { err = -ENOMEM; - goto out_free_cpu; + goto out_uninit_cpu; } kvm_info("Allocated %d bytes for KVM Exception Handlers @ %p\n", ALIGN(size, PAGE_SIZE), gebase); @@ -373,6 +373,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st out_free_gebase: kfree(gebase); +out_uninit_cpu: + kvm_vcpu_uninit(vcpu); + out_free_cpu: kfree(vcpu); -- To unsubscribe from this list: send the line "unsubscribe kvm" in