Re: [PATCH v3 01/12] KVM: s390: unregister debug feature on failing arch init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/11/2018 11:19, Michael Mueller wrote:
Make sure the debug feature and its allocated resources get
released upon unsuccessful architecture initialization.

A related idication of the issue will be reported by common
kvm code.

Signed-off-by: Michael Mueller <mimu@xxxxxxxxxxxxx>
---
  arch/s390/kvm/kvm-s390.c | 16 +++++++++++++---
  1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index fe24150ff666..d9635d21563f 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -417,19 +417,29 @@ static void kvm_s390_cpu_feat_init(void)
int kvm_arch_init(void *opaque)
  {
+	int rc;
+
  	kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long));
  	if (!kvm_s390_dbf)
  		return -ENOMEM;
if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view)) {
-		debug_unregister(kvm_s390_dbf);
-		return -ENOMEM;
+		rc = -ENOMEM;
+		goto out_unreg;
  	}
kvm_s390_cpu_feat_init(); /* Register floating interrupt controller interface. */
-	return kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);
+	rc = kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);
+	if (rc)
+		goto out_unreg;
+
+	return 0;
+
+out_unreg:
+	debug_unregister(kvm_s390_dbf);
+	return rc;
  }
void kvm_arch_exit(void)


looks like a bug.
CC stable ?

Reviewed-by: Pierre Morel<pmorel@xxxxxxxxxxxxx>

--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux