From: Ján Tomko Date: Thu, 27 Jan 2022 18:18:24 +0000 (+0100) Subject: qemu: virtiofs: check whether the supplied binary exists X-Git-Tag: v8.1.0-rc1~198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=459f8009c29a40b48f1a28846003d1c5d7e04539;p=thirdparty%2Flibvirt.git qemu: virtiofs: check whether the supplied binary exists Report an error upfront if the binary does not exist or is not executable. https://bugzilla.redhat.com/show_bug.cgi?id=1999372 Signed-off-by: Ján Tomko Reviewed-by: Andrea Bolognani --- diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 1b853a5a59..7e3324b017 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -184,6 +184,13 @@ qemuVirtioFSStart(virQEMUDriver *driver, VIR_AUTOCLOSE logfd = -1; int rc; + if (!virFileIsExecutable(fs->binary)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("virtiofsd binary '%s' is not executable"), + fs->binary); + return -1; + } + if (!virFileExists(fs->src->path)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("the virtiofs export directory '%s' does not exist"),