qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] util/async: avoid NULL pointer dereference
@ 2018-06-11  7:04 Jie Wang
  2018-06-11  9:29 ` Fam Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Jie Wang @ 2018-06-11  7:04 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: famz, stefanha, eblake, eric.fangyi, wu.wubin, wangjie88

if laio_init create linux_aio failed and return NULL, NULL pointer
dereference will occur when laio_attach_aio_context dereference
linux_aio in aio_get_linux_aio, so add assert to avoid it.

Signed-off-by: Jie Wang <wangjie88@huawei.com>
---
 util/async.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/async.c b/util/async.c
index 03f62787f2..7766bcd8bc 100644
--- a/util/async.c
+++ b/util/async.c
@@ -327,6 +327,7 @@ LinuxAioState *aio_get_linux_aio(AioContext *ctx)
 {
     if (!ctx->linux_aio) {
         ctx->linux_aio = laio_init();
+        assert(ctx->linux_aio);
         laio_attach_aio_context(ctx->linux_aio, ctx);
     }
     return ctx->linux_aio;
-- 
2.15.0.windows.1

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

end of thread, other threads:[~2018-06-11  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-11  7:04 [Qemu-devel] [PATCH] util/async: avoid NULL pointer dereference Jie Wang
2018-06-11  9:29 ` Fam Zheng

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