From: Greg Kurz <gr...@kaod.org> 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 <gr...@kaod.org> Reviewed-by: Li Qiang <liq...@gmail.com> (cherry picked from commit f2b58c43758efc61e2a49b899f5e58848489d0dc) Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> --- hw/9pfs/9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index faebd91..68725b7 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -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); -- 2.7.4