[3.16.y-ckt stable] Patch "KVM: s390: avoid memory leaks if __inject_vm() fails" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Mon Mar 2 13:34:46 UTC 2015


This is a note to let you know that I have just added a patch titled

    KVM: s390: avoid memory leaks if __inject_vm() fails

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt8.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 0aba2a81c958e4ba30f4ce141fb4985deb5e5a05 Mon Sep 17 00:00:00 2001
From: David Hildenbrand <dahi at linux.vnet.ibm.com>
Date: Fri, 16 Jan 2015 12:58:09 +0100
Subject: KVM: s390: avoid memory leaks if __inject_vm() fails

commit 428d53be5e7468769d4e7899cca06ed5f783a6e1 upstream.

We have to delete the allocated interrupt info if __inject_vm() fails.

Otherwise user space can keep flooding kvm with floating interrupts and
provoke more and more memory leaks.

Reported-by: Dominik Dingel <dingel at linux.vnet.ibm.com>
Reviewed-by: Dominik Dingel <dingel at linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi at linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger at de.ibm.com>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 arch/s390/kvm/interrupt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index db3625ae7a47..e2354f97264e 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -951,6 +951,7 @@ int kvm_s390_inject_vm(struct kvm *kvm,
 		       struct kvm_s390_interrupt *s390int)
 {
 	struct kvm_s390_interrupt_info *inti;
+	int rc;

 	inti = kzalloc(sizeof(*inti), GFP_KERNEL);
 	if (!inti)
@@ -998,7 +999,10 @@ int kvm_s390_inject_vm(struct kvm *kvm,
 	trace_kvm_s390_inject_vm(s390int->type, s390int->parm, s390int->parm64,
 				 2);

-	return __inject_vm(kvm, inti);
+	rc = __inject_vm(kvm, inti);
+	if (rc)
+		kfree(inti);
+	return rc;
 }

 void kvm_s390_reinject_io_int(struct kvm *kvm,




More information about the kernel-team mailing list