Skip to contentSkip to conversation

Patch "MIPS: KVM: Uninit VCPU in vcpu_create error path" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Mar 1, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

MIPS: KVM: Uninit VCPU in vcpu_create error path

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-kvm-uninit-vcpu-in-vcpu_create-error-path.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 585bb8f9a5e592f2ce7abbe5ed3112d5438d2754 Mon Sep 17 00:00:00 2001

From: James Hogan <[email protected]>
Date: Wed, 11 Nov 2015 14:21:20 +0000
Subject: MIPS: KVM: Uninit VCPU in vcpu_create error path

From: James Hogan <[email protected]>

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")
Cc Ralf Baechle <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Gleb Natapov <[email protected]>
---
 arch/mips/kvm/kvm_mips.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/mips/kvm/kvm_mips.c +4 -1
@@ -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);
 

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/mips-kvm-fix-cache-immediate-offset-sign-extension.patch queue-3.14/mips-kvm-uninit-vcpu-in-vcpu_create-error-path.patch queue-3.14/mips-kvm-fix-asid-restoration-logic.patch