mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
qemu: sanity check vhost user FD before passing to QEMU
Ensure that the FD we're passing to QEMU is actually open, so we get a sane error message upfront instead of telling QEMU to use a closed FD. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -4704,6 +4704,12 @@ qemuBuildVhostUserChardevStr(const char *alias,
|
||||
{
|
||||
char *chardev = NULL;
|
||||
|
||||
if (*fd == -1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Attempt to pass closed vhostuser FD"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (virAsprintf(&chardev, "socket,id=chr-vu-%s,fd=%d", alias, *fd) < 0)
|
||||
return NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user