render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
Pablo Greco 40546a
From c627fa58c17960e5eed999049bf966b5ea952c3b Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <c627fa58c17960e5eed999049bf966b5ea952c3b@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Fri, 30 Aug 2019 16:35:33 +0200
Pablo Greco 40546a
Subject: [PATCH] vircgroupv2: fix abort in VIR_AUTOFREE
Pablo Greco 40546a
Pablo Greco 40546a
Introduced by commit <c854e0bd33c7a5afb04a36465bf04f861b2efef5> that
Pablo Greco 40546a
tried to fix an issue where we would fail to parse values from files.
Pablo Greco 40546a
Pablo Greco 40546a
We cannot change the original pointer that is going to be used by
Pablo Greco 40546a
VIR_AUTOFREE.
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1747440
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Acked-by: Peter Krempa <pkrempa@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 9a99b01f8d3b2be491f9f8412c6f894d30d7e2fe)
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <c9be614c3648b2901481f257ba1af3fcd8fe7e76.1567175708.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/vircgroupv2.c | 6 ++++--
Pablo Greco 40546a
 1 file changed, 4 insertions(+), 2 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
Pablo Greco 40546a
index e31a2d1121..e7b9093754 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv2.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv2.c
Pablo Greco 40546a
@@ -848,6 +848,7 @@ virCgroupV2GetBlkioDeviceWeight(virCgroupPtr group,
Pablo Greco 40546a
     VIR_AUTOFREE(char *) path = NULL;
Pablo Greco 40546a
     VIR_AUTOFREE(char *) str = NULL;
Pablo Greco 40546a
     VIR_AUTOFREE(char *) value = NULL;
Pablo Greco 40546a
+    char *tmp;
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (virCgroupV2PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
Pablo Greco 40546a
                                     "io.weight", &path) < 0) {
Pablo Greco 40546a
@@ -868,7 +869,7 @@ virCgroupV2GetBlkioDeviceWeight(virCgroupPtr group,
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (!str) {
Pablo Greco 40546a
         *weight = 0;
Pablo Greco 40546a
-    } else if (virStrToLong_ui(str, &str, 10, weight) < 0) {
Pablo Greco 40546a
+    } else if (virStrToLong_ui(str, &tmp, 10, weight) < 0) {
Pablo Greco 40546a
         virReportError(VIR_ERR_INTERNAL_ERROR,
Pablo Greco 40546a
                        _("Unable to parse '%s' as an integer"),
Pablo Greco 40546a
                        str);
Pablo Greco 40546a
@@ -1575,6 +1576,7 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
Pablo Greco 40546a
                           long long *cfs_quota)
Pablo Greco 40546a
 {
Pablo Greco 40546a
     VIR_AUTOFREE(char *) str = NULL;
Pablo Greco 40546a
+    char *tmp;
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (virCgroupGetValueStr(group, VIR_CGROUP_CONTROLLER_CPU,
Pablo Greco 40546a
                              "cpu.max", &str) < 0) {
Pablo Greco 40546a
@@ -1586,7 +1588,7 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
Pablo Greco 40546a
         return 0;
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
-    if (virStrToLong_ll(str, &str, 10, cfs_quota) < 0) {
Pablo Greco 40546a
+    if (virStrToLong_ll(str, &tmp, 10, cfs_quota) < 0) {
Pablo Greco 40546a
         virReportError(VIR_ERR_INTERNAL_ERROR,
Pablo Greco 40546a
                        _("Failed to parse value '%s' from cpu.max."), str);
Pablo Greco 40546a
         return -1;
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.23.0
Pablo Greco 40546a