qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] util/async: avoid NULL pointer dereference


From: Jie Wang
Subject: [Qemu-devel] [PATCH] util/async: avoid NULL pointer dereference
Date: Mon, 11 Jun 2018 15:04:07 +0800

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]