libvirt-8.4.0-3.el9

- qemu: fd: Fix monitor usage of qemuFDPassDirectGetPath (rhbz#2092856)

Resolves: rhbz#2092856
This commit is contained in:
Jiri Denemark 2022-06-24 11:30:53 +02:00
parent 228f4b83ba
commit 07034509ca
2 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,83 @@
From c52ee15b701c207d205b296e535202272ad6a525 Mon Sep 17 00:00:00 2001
Message-Id: <c52ee15b701c207d205b296e535202272ad6a525@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 3 Jun 2022 15:49:01 +0200
Subject: [PATCH] qemu: fd: Fix monitor usage of qemuFDPassDirectGetPath
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We need to use the 'name' variable and just overwrite it with the FD
number when FDs are passed on the monitor. Otherwise we will read NULL
path if the FD is accessed before being passed on the monitor. The idea
of this helper is to simplify the monitor code so it would be
counterproductive to have other behaviour.
Fixes the following symptom:
$ virsh attach-interface cd network default --model virtio
error: Failed to attach interface
error: internal error: unable to execute QEMU command 'netdev_add': File descriptor named '(null)' has not been found
Fixes: bca9047906fd73fd30f275dd45b64998fbbcf6de
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/318
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2092856
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 8d3a807a4acce72a9bce50dd6496c7e320cace39)
https://bugzilla.redhat.com/show_bug.cgi?id=2092856
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_fd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_fd.c b/src/qemu/qemu_fd.c
index bc6a37663c..40c8234320 100644
--- a/src/qemu/qemu_fd.c
+++ b/src/qemu/qemu_fd.c
@@ -235,7 +235,6 @@ qemuFDPassGetPath(qemuFDPass *fdpass)
struct _qemuFDPassDirect {
int fd;
- char *path;
char *name;
bool passed; /* passed to qemu via monitor */
@@ -251,7 +250,6 @@ qemuFDPassDirectFree(qemuFDPassDirect *fdpass)
VIR_FORCE_CLOSE(fdpass->fd);
g_free(fdpass->name);
- g_free(fdpass->path);
g_free(fdpass);
}
@@ -295,7 +293,8 @@ qemuFDPassDirectTransferCommand(qemuFDPassDirect *fdpass,
return;
virCommandPassFD(cmd, fdpass->fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
- fdpass->path = g_strdup_printf("%d", fdpass->fd);
+ g_free(fdpass->name);
+ fdpass->name = g_strdup_printf("%d", fdpass->fd);
fdpass->fd = -1;
}
@@ -318,7 +317,6 @@ qemuFDPassDirectTransferMonitor(qemuFDPassDirect *fdpass,
if (qemuMonitorSendFileHandle(mon, fdpass->name, fdpass->fd) < 0)
return -1;
- fdpass->path = g_strdup(fdpass->name);
VIR_FORCE_CLOSE(fdpass->fd);
fdpass->passed = true;
@@ -358,5 +356,5 @@ qemuFDPassDirectGetPath(qemuFDPassDirect *fdpass)
if (!fdpass)
return NULL;
- return fdpass->path;
+ return fdpass->name;
}
--
2.35.1

View File

@ -228,7 +228,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 8.4.0
Release: 2%{?dist}%{?extra_release}
Release: 3%{?dist}%{?extra_release}
License: LGPLv2+
URL: https://libvirt.org/
@ -240,6 +240,7 @@ Source1: symlinks
Patch1: libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch
Patch2: libvirt-Revert-RHEL-Fix-virConnectGetMaxVcpus-output.patch
Patch3: libvirt-qemu-fd-Fix-monitor-usage-of-qemuFDPassDirectGetPath.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -2145,6 +2146,9 @@ exit 0
%changelog
* Fri Jun 24 2022 Jiri Denemark <jdenemar@redhat.com> - 8.4.0-3
- qemu: fd: Fix monitor usage of qemuFDPassDirectGetPath (rhbz#2092856)
* Tue Jun 14 2022 Jiri Denemark <jdenemar@redhat.com> - 8.4.0-2
- Revert "RHEL: Fix virConnectGetMaxVcpus output" (rhbz#2095260)