public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [1/2]Fix missing bad_page free logic in kvm_init
@ 2007-11-29  8:16 Zhang, Xiantao
       [not found] ` <42DFA526FC41B1429CE7279EF83C6BDCA394B4-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Xiantao @ 2007-11-29  8:16 UTC (permalink / raw)
  To: avi-atKUWr5tajBWk0Htik3J/w
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	carsteno-tA70FqPdS9bQT0dZR+AlfA, hollisb-r/Jw6+rmf7HQT0dZR+AlfA

[-- Attachment #1: Type: text/plain, Size: 2632 bytes --]

From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date: Thu, 29 Nov 2007 15:35:39 +0800
Subject: [PATCH] Add bad_page free logic for possbile failures of
kvm_init.
Add bad_page free logic for possbile failures of kvm_init.

Signed-off-by: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/kvm/kvm_main.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0ac1a5f..a6fbe6b 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1340,7 +1340,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
 
 	r = kvm_arch_init(opaque);
 	if (r)
-		goto out4;
+		goto out_fail;
 
 	bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 
@@ -1351,29 +1351,29 @@ int kvm_init(void *opaque, unsigned int
vcpu_size,
 
 	r = kvm_arch_hardware_setup();
 	if (r < 0)
-		goto out;
+		goto out_free_0;
 
 	for_each_online_cpu(cpu) {
 		smp_call_function_single(cpu,
 				kvm_arch_check_processor_compat,
 				&r, 0, 1);
 		if (r < 0)
-			goto out_free_0;
+			goto out_free_1;
 	}
 
 	on_each_cpu(hardware_enable, NULL, 0, 1);
 	r = register_cpu_notifier(&kvm_cpu_notifier);
 	if (r)
-		goto out_free_1;
+		goto out_free_2;
 	register_reboot_notifier(&kvm_reboot_notifier);
 
 	r = sysdev_class_register(&kvm_sysdev_class);
 	if (r)
-		goto out_free_2;
+		goto out_free_3;
 
 	r = sysdev_register(&kvm_sysdev);
 	if (r)
-		goto out_free_3;
+		goto out_free_4;
 
 	/* A kmem cache lets us meet the alignment requirements of
fx_save. */
 	kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size,
@@ -1381,7 +1381,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
 					   0, NULL);
 	if (!kvm_vcpu_cache) {
 		r = -ENOMEM;
-		goto out_free_4;
+		goto out_free_5;
 	}
 
 	kvm_chardev_ops.owner = module;
@@ -1399,21 +1399,23 @@ int kvm_init(void *opaque, unsigned int
vcpu_size,
 
 out_free:
 	kmem_cache_destroy(kvm_vcpu_cache);
-out_free_4:
+out_free_5:
 	sysdev_unregister(&kvm_sysdev);
-out_free_3:
+out_free_4:
 	sysdev_class_unregister(&kvm_sysdev_class);
-out_free_2:
+out_free_3:
 	unregister_reboot_notifier(&kvm_reboot_notifier);
 	unregister_cpu_notifier(&kvm_cpu_notifier);
-out_free_1:
+out_free_2:
 	on_each_cpu(hardware_disable, NULL, 0, 1);
-out_free_0:
+out_free_1:
 	kvm_arch_hardware_unsetup();
+out_free_0:
+	__free_page(bad_page);
 out:
 	kvm_arch_exit();
 	kvm_exit_debug();
-out4:
+out_fail:
 	return r;
 }
 EXPORT_SYMBOL_GPL(kvm_init);
-- 
1.5.1.2

[-- Attachment #2: 0001-Add-bad_page-free-logic-for-possbile-failures-of-kvm.patch --]
[-- Type: application/octet-stream, Size: 2541 bytes --]

From 2b428f0b89108189324acf68a5226f75eb8d5fd8 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Thu, 29 Nov 2007 15:35:39 +0800
Subject: [PATCH] Add bad_page free logic for possbile failures of kvm_init.
Add bad_page free logic for possbile failures of kvm_init.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 drivers/kvm/kvm_main.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0ac1a5f..a6fbe6b 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1340,7 +1340,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
 
 	r = kvm_arch_init(opaque);
 	if (r)
-		goto out4;
+		goto out_fail;
 
 	bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 
@@ -1351,29 +1351,29 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
 
 	r = kvm_arch_hardware_setup();
 	if (r < 0)
-		goto out;
+		goto out_free_0;
 
 	for_each_online_cpu(cpu) {
 		smp_call_function_single(cpu,
 				kvm_arch_check_processor_compat,
 				&r, 0, 1);
 		if (r < 0)
-			goto out_free_0;
+			goto out_free_1;
 	}
 
 	on_each_cpu(hardware_enable, NULL, 0, 1);
 	r = register_cpu_notifier(&kvm_cpu_notifier);
 	if (r)
-		goto out_free_1;
+		goto out_free_2;
 	register_reboot_notifier(&kvm_reboot_notifier);
 
 	r = sysdev_class_register(&kvm_sysdev_class);
 	if (r)
-		goto out_free_2;
+		goto out_free_3;
 
 	r = sysdev_register(&kvm_sysdev);
 	if (r)
-		goto out_free_3;
+		goto out_free_4;
 
 	/* A kmem cache lets us meet the alignment requirements of fx_save. */
 	kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size,
@@ -1381,7 +1381,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
 					   0, NULL);
 	if (!kvm_vcpu_cache) {
 		r = -ENOMEM;
-		goto out_free_4;
+		goto out_free_5;
 	}
 
 	kvm_chardev_ops.owner = module;
@@ -1399,21 +1399,23 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
 
 out_free:
 	kmem_cache_destroy(kvm_vcpu_cache);
-out_free_4:
+out_free_5:
 	sysdev_unregister(&kvm_sysdev);
-out_free_3:
+out_free_4:
 	sysdev_class_unregister(&kvm_sysdev_class);
-out_free_2:
+out_free_3:
 	unregister_reboot_notifier(&kvm_reboot_notifier);
 	unregister_cpu_notifier(&kvm_cpu_notifier);
-out_free_1:
+out_free_2:
 	on_each_cpu(hardware_disable, NULL, 0, 1);
-out_free_0:
+out_free_1:
 	kvm_arch_hardware_unsetup();
+out_free_0:
+	__free_page(bad_page);
 out:
 	kvm_arch_exit();
 	kvm_exit_debug();
-out4:
+out_fail:
 	return r;
 }
 EXPORT_SYMBOL_GPL(kvm_init);
-- 
1.5.1.2


[-- Attachment #3: Type: text/plain, Size: 309 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] [1/2]Fix missing bad_page free logic in kvm_init
       [not found] ` <42DFA526FC41B1429CE7279EF83C6BDCA394B4-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-11-29 12:15   ` Carsten Otte
  2007-11-30  7:39   ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Otte @ 2007-11-29 12:15 UTC (permalink / raw)
  To: Zhang, Xiantao
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	carsteno-tA70FqPdS9bQT0dZR+AlfA, hollisb-r/Jw6+rmf7HQT0dZR+AlfA,
	avi-atKUWr5tajBWk0Htik3J/w

Zhang, Xiantao wrote:
> From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Date: Thu, 29 Nov 2007 15:35:39 +0800
> Subject: [PATCH] Add bad_page free logic for possbile failures of
> kvm_init.
> Add bad_page free logic for possbile failures of kvm_init.
> 
> Signed-off-by: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Acked-by: Carsten Otte <carsteno-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [1/2]Fix missing bad_page free logic in kvm_init
       [not found] ` <42DFA526FC41B1429CE7279EF83C6BDCA394B4-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2007-11-29 12:15   ` Carsten Otte
@ 2007-11-30  7:39   ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2007-11-30  7:39 UTC (permalink / raw)
  To: Zhang, Xiantao
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	carsteno-tA70FqPdS9bQT0dZR+AlfA, hollisb-r/Jw6+rmf7HQT0dZR+AlfA

Zhang, Xiantao wrote:
> From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Date: Thu, 29 Nov 2007 15:35:39 +0800
> Subject: [PATCH] Add bad_page free logic for possbile failures of
> kvm_init.
> Add bad_page free logic for possbile failures of kvm_init.
>
>   


Applied, thanks.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-30  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29  8:16 [PATCH] [1/2]Fix missing bad_page free logic in kvm_init Zhang, Xiantao
     [not found] ` <42DFA526FC41B1429CE7279EF83C6BDCA394B4-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-29 12:15   ` Carsten Otte
2007-11-30  7:39   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox