From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755660AbcCAXzm (ORCPT ); Tue, 1 Mar 2016 18:55:42 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:34623 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755501AbcCAXzW (ORCPT ); Tue, 1 Mar 2016 18:55:22 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=h3CjqKYkfxPdXNpjOrB8OE4/UNlLjKbGBU99lrzOi/nEhCklWxMdJYlBxIGg2S6XGgzNf5pF/CXn HnQQyaqFKK1th/jlQ1b9liI/JmDW5MrU7Xo+G399Zg304LkuOM3cMVirxoqVJFm/p5unaZOXM7R2 tjxbPq+ga9zWthFI2fA=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 051/342] KVM: s390: fix guest fprs memory leak X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Eric Farman , David Hildenbrand , Christian Borntraeger Message-Id: <20160301234529.660985612@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@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.906a4a9b84c4442fbb9c8a4f6eb54fdb X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:54:00 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Hildenbrand commit 9c7ebb613bffea2feef4ec562ba1dbcaa810942b upstream. fprs is never freed, therefore resulting in a memory leak if kvm_vcpu_init() fails or the vcpu is destroyed. Fixes: 9977e886cbbc ("s390/kernel: lazy restore fpu registers") Reported-by: Eric Farman Signed-off-by: David Hildenbrand Reviewed-by: Eric Farman Signed-off-by: Christian Borntraeger Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/kvm-s390.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -1202,6 +1202,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vc if (vcpu->kvm->arch.use_cmma) kvm_s390_vcpu_unsetup_cmma(vcpu); + kfree(vcpu->arch.guest_fpregs.fprs); free_page((unsigned long)(vcpu->arch.sie_block)); kvm_vcpu_uninit(vcpu); @@ -1516,12 +1517,14 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st rc = kvm_vcpu_init(vcpu, kvm, id); if (rc) - goto out_free_sie_block; + goto out_free_fprs; VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu, vcpu->arch.sie_block); trace_kvm_s390_create_vcpu(id, vcpu, vcpu->arch.sie_block); return vcpu; +out_free_fprs: + kfree(vcpu->arch.guest_fpregs.fprs); out_free_sie_block: free_page((unsigned long)(vcpu->arch.sie_block)); out_free_cpu: