qemu-devel
[Top][All Lists]
Advanced

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

Re: [PULL 03/19] monitor: hmp_qemu_io: acquire aio contex, fix crash


From: Max Reitz
Subject: Re: [PULL 03/19] monitor: hmp_qemu_io: acquire aio contex, fix crash
Date: Thu, 20 May 2021 15:51:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 20.05.21 15:44, Peter Maydell wrote:
On Fri, 14 May 2021 at 17:45, Max Reitz <mreitz@redhat.com> wrote:

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Hi; Coverity complains about this code (CID 1453194):

diff --git a/qemu-io.c b/qemu-io.c
index bf902302e9..57f07501df 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -411,6 +411,19 @@ static void prep_fetchline(void *opaque)
      *fetchable= 1;
  }

+static int do_qemuio_command(const char *cmd)
+{
+    int ret;
+    AioContext *ctx =
+        qemuio_blk ? blk_get_aio_context(qemuio_blk) : qemu_get_aio_context();

Here we check whether qemuio_blk is NULL...

+
+    aio_context_acquire(ctx);
+    ret = qemuio_command(qemuio_blk, cmd);

...but here we pass it to qemuio_command(), which assumes it must
be non-NULL (via calling command() which calls blk_is_available()).

Bug, or false positive ?

It’s a false positive, Vladimir has sent a patch to silence Coverity:

https://lists.nongnu.org/archive/html/qemu-block/2021-05/msg00853.html

Max




reply via email to

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