All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] 9pfs: fix NULL pointer dereference in v9fs_version
@ 2016-09-27  4:38 Li Qiang
  2016-09-27  7:35 ` Greg Kurz
  0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2016-09-27  4:38 UTC (permalink / raw)
  To: aneesh.kumar, groug, qemu-devel; +Cc: Li Qiang

From: Li Qiang <liqiang6-s@360.cn>

In 9pfs get version dispatch function, a guest can provide a NULL
version string thus causing an NULL pointer dereference issue.
This patch fix this issue.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/9pfs/9p.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 119ee58..dd3145c 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -955,6 +955,11 @@ static void v9fs_version(void *opaque)
         offset = err;
         goto out;
     }
+
+    if (!version.data) {
+        offset = -EINVAL;
+        goto out;
+    }
     trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data);
 
     virtfs_reset(pdu);
-- 
1.8.3.1

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

end of thread, other threads:[~2016-09-27  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27  4:38 [Qemu-devel] [PATCH] 9pfs: fix NULL pointer dereference in v9fs_version Li Qiang
2016-09-27  7:35 ` Greg Kurz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.