]> git.proxmox.com Git - mirror_qemu.git/commit
curl: Don't deref NULL pointer in call to aio_poll.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 28 Aug 2014 08:04:21 +0000 (09:04 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 29 Aug 2014 15:19:01 +0000 (16:19 +0100)
commita2f468e48f8b6559ec9123e94948bc373b788941
tree0e7552cf4a40bc828c8d9c4528008cb355cb1276
parenta94f83d94fdf907680f068f1be7ad13d1f697067
curl: Don't deref NULL pointer in call to aio_poll.

In commit 63f0f45f2e89b60ff8245fec81328ddfde42a303 the following
mechanical change was made:

         if (!state) {
-            qemu_aio_wait();
+            aio_poll(state->s->aio_context, true);
         }

The new code now checks if state is NULL and then dereferences it
('state->s') which is obviously incorrect.

This commit replaces state->s->aio_context with
bdrv_get_aio_context(bs), fixing this problem.  The two other hunks
are concerned with getting the BlockDriverState pointer bs to where it
is needed.

The original bug causes a segfault when using libguestfs to access a
VMware vCenter Server and doing any kind of complex read-heavy
operations.  With this commit the segfault goes away.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: BenoƮt Canet <benoit.canet@nodalink.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/curl.c