qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] 9pfs: fix crash when fsdev is missing
@ 2016-12-19 14:28 Greg Kurz
  2016-12-20  2:01 ` Li Qiang
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2016-12-19 14:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aneesh Kumar K.V, liq3ea, qemu-stable, Greg Kurz

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>
---
 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 faebd91f5fab..68725b7a1c97 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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] 9pfs: fix crash when fsdev is missing
  2016-12-19 14:28 [Qemu-devel] [PATCH] 9pfs: fix crash when fsdev is missing Greg Kurz
@ 2016-12-20  2:01 ` Li Qiang
  0 siblings, 0 replies; 2+ messages in thread
From: Li Qiang @ 2016-12-20  2:01 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-devel, Aneesh Kumar K.V, qemu-stable

On 2016-12-19 22:28 GMT+08:00 Greg Kurz <groug@kaod.org> wrote:

> 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>


> ---
>  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 faebd91f5fab..68725b7a1c97 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);
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-20  2:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 14:28 [Qemu-devel] [PATCH] 9pfs: fix crash when fsdev is missing Greg Kurz
2016-12-20  2:01 ` Li Qiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).