]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
9pfs: fix crash when fsdev is missing
authorGreg Kurz <groug@kaod.org>
Tue, 3 Jan 2017 16:28:44 +0000 (17:28 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 16 Mar 2017 17:10:39 +0000 (12:10 -0500)
If the user passes -device virtio-9p without the corresponding -fsdev, QEMU
dereferences a NULL pointer and crashes.

This is a 2.8 regression introduced by commit 702dbcc274e2c.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
(cherry picked from commit f2b58c43758efc61e2a49b899f5e58848489d0dc)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/9pfs/9p.c

index faebd91f5fab85384d8c9a73a4533c5c40c038f8..68725b7a1c970cbe7978ccb608b70ee7ea3e54bb 100644 (file)
@@ -3521,7 +3521,7 @@ int v9fs_device_realize_common(V9fsState *s, Error **errp)
     rc = 0;
 out:
     if (rc) {
-        if (s->ops->cleanup && s->ctx.private) {
+        if (s->ops && s->ops->cleanup && s->ctx.private) {
             s->ops->cleanup(&s->ctx);
         }
         g_free(s->tag);