libvirt/SOURCES/libvirt-cpu-fix-cleanup-when-signature-parsing-fails.patch
2021-09-10 11:57:18 +00:00

52 lines
1.9 KiB
Diff

From 612913a764992dc1a9ae63762749ecee447427d7 Mon Sep 17 00:00:00 2001
Message-Id: <612913a764992dc1a9ae63762749ecee447427d7@dist-git>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Fri, 21 Jun 2019 09:24:45 +0200
Subject: [PATCH] cpu: fix cleanup when signature parsing fails
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Two pieces of code accidentally jumped to the wrong label when they
failed causing incorrect cleanup, returning a partially initialized
CPU model struct.
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 118fcdd480ad38a3e8477f466f6a876dce7e9fa6)
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <5e9aedc6fd4f4570322a7d13626863bec0449283.1561068591.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 89baf94d7d..124aa5fd5e 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1250,7 +1250,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature family in model %s"),
model->name);
- goto cleanup;
+ goto error;
}
rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
@@ -1258,7 +1258,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature model in model %s"),
model->name);
- goto cleanup;
+ goto error;
}
model->signature = x86MakeSignature(sigFamily, sigModel, 0);
--
2.22.0