From 3465fa3f8a71fe277e954a08aca27b1c298a3f4d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 18 2022 12:17:20 +0000 Subject: import qemu-kvm-1.5.3-175.el7_9.6 --- diff --git a/SOURCES/kvm-rbd-avoid-qemu_rbd_snap_list-memory-leaks.patch b/SOURCES/kvm-rbd-avoid-qemu_rbd_snap_list-memory-leaks.patch new file mode 100644 index 0000000..56ee4fe --- /dev/null +++ b/SOURCES/kvm-rbd-avoid-qemu_rbd_snap_list-memory-leaks.patch @@ -0,0 +1,57 @@ +From 3acda11a1add5b08d3b2f26dcb96de06581ff094 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Wed, 25 Sep 2013 16:00:48 +0200 +Subject: [PATCH] rbd: avoid qemu_rbd_snap_list() memory leaks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Stefano Garzarella +RH-MergeRequest: 118: rbd: avoid qemu_rbd_snap_list() memory leaks +RH-Commit: [1/1] b7270277ecf931b119d5606f644793f32478e4c4 +RH-Bugzilla: 2056725 +RH-Acked-by: Daniel P. Berrangé +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Kevin Wolf +RH-Acked-by: Hanna Reitz + +When there are no snapshots qemu_rbd_snap_list() returns 0 and the +snapshot table pointer is NULL. Don't forget to free the snaps buffer +we allocated for librbd rbd_snap_list(). + +When the function succeeds don't forget to free the snaps buffer after +calling rbd_snap_list_end(). + +Cc: qemu-stable@nongnu.org +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Kevin Wolf +(cherry picked from commit 9e6337d0818650362149b734d53edf9489f3acaa) +Signed-off-by: Stefano Garzarella +--- + block/rbd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/block/rbd.c b/block/rbd.c +index b982658db4..996e86272e 100644 +--- a/block/rbd.c ++++ b/block/rbd.c +@@ -952,7 +952,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs, + do { + snaps = g_malloc(sizeof(*snaps) * max_snaps); + snap_count = rbd_snap_list(s->image, snaps, &max_snaps); +- if (snap_count < 0) { ++ if (snap_count <= 0) { + g_free(snaps); + } + } while (snap_count == -ERANGE); +@@ -976,6 +976,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs, + sn_info->vm_clock_nsec = 0; + } + rbd_snap_list_end(snaps); ++ g_free(snaps); + + done: + *psn_tab = sn_tab; +-- +2.27.0 + diff --git a/SPECS/qemu-kvm.spec b/SPECS/qemu-kvm.spec index 0b6258d..3c11be5 100644 --- a/SPECS/qemu-kvm.spec +++ b/SPECS/qemu-kvm.spec @@ -14,7 +14,7 @@ %global have_usbredir 0 %endif -%ifnarch s390 s390x %{arm} +%ifnarch s390 s390x %global have_librdma 1 %global have_tcmalloc 1 %endif @@ -41,9 +41,6 @@ %ifarch aarch64 %global kvm_target aarch64 %endif -%ifarch %{arm} - %global kvm_target arm -%endif #Versions of various parts: @@ -79,13 +76,13 @@ Obsoletes: %1 < %{obsoletes_version} \ Summary: QEMU is a machine emulator and virtualizer Name: %{pkgname}%{?pkgsuffix} Version: 1.5.3 -Release: 175%{?dist}.5 +Release: 175%{?dist}.6 # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 10 License: GPLv2 and GPLv2+ and CC-BY Group: Development/Tools URL: http://www.qemu.org/ -ExclusiveArch: x86_64 %{arm} +ExclusiveArch: x86_64 Requires: seabios-bin >= 1.7.2.2-5 Requires: sgabios-bin Requires: seavgabios-bin @@ -4058,6 +4055,8 @@ Patch1998: kvm-Suppress-prototype-warning-for-nss-headers.patch Patch1999: kvm-ide-atapi-check-logical-block-address-and-read-size-.patch # For bz#2007036 - Memory leak when using dma_read/write with virtio-scsi Patch2000: kvm-dma-helpers-Initialize-DMAAIOCB-in_cancel-flag.patch +# For bz#2056725 - qemu-kvm leaks on qemu_rbd_snap_list +Patch2001: kvm-rbd-avoid-qemu_rbd_snap_list-memory-leaks.patch BuildRequires: zlib-devel @@ -6236,6 +6235,7 @@ tar -xf %{SOURCE21} %patch1998 -p1 %patch1999 -p1 %patch2000 -p1 +%patch2001 -p1 %build buildarch="%{kvm_target}-softmmu" @@ -6681,6 +6681,11 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || : %{_mandir}/man8/qemu-nbd.8* %changelog +* Fri Feb 25 2022 Jon Maloy - 1.5.3-175.el7_9.6 +- kvm-rbd-avoid-qemu_rbd_snap_list-memory-leaks.patch [bz#2056725] +- Resolves: bz#2056725 + (qemu-kvm leaks on qemu_rbd_snap_list) + * Fri Nov 12 2021 Jon Maloy - 1.5.3-175.el7_9.5 - kvm-dma-helpers-Initialize-DMAAIOCB-in_cancel-flag.patch [bz#2007036] - Resolves: bz#2007036