qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Qemu-block <qemu-block@nongnu.org>
Subject: Re: [PULL 03/19] monitor: hmp_qemu_io: acquire aio contex, fix crash
Date: Thu, 20 May 2021 14:44:15 +0100	[thread overview]
Message-ID: <CAFEAcA_MynMjOYHmYrkGigV2hF7sFEofFW2vxZuOOs-rxk1=Bg@mail.gmail.com> (raw)
In-Reply-To: <20210514164514.1057680-4-mreitz@redhat.com>

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 ?

thanks
-- PMM


  reply	other threads:[~2021-05-20 13:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 16:44 [PULL 00/19] Block patches Max Reitz
2021-05-14 16:44 ` [PULL 01/19] iotests/231: Update expected deprecation message Max Reitz
2021-05-14 16:44 ` [PULL 02/19] block/rbd: Add an escape-aware strchr helper Max Reitz
2021-05-14 16:44 ` [PULL 03/19] monitor: hmp_qemu_io: acquire aio contex, fix crash Max Reitz
2021-05-20 13:44   ` Peter Maydell [this message]
2021-05-20 13:51     ` Max Reitz
2021-05-14 16:44 ` [PULL 04/19] mirror: stop cancelling in-flight requests on non-force cancel in READY Max Reitz
2021-05-14 16:45 ` [PULL 05/19] qemu-iotests: do not buffer the test output Max Reitz
2021-05-14 16:45 ` [PULL 06/19] qemu-iotests: allow passing unittest.main arguments to the test scripts Max Reitz
2021-05-14 16:45 ` [PULL 07/19] qemu-iotests: move command line and environment handling from TestRunner to TestEnv Max Reitz
2021-05-14 16:45 ` [PULL 08/19] qemu-iotests: let "check" spawn an arbitrary test command Max Reitz
2021-05-14 16:45 ` [PULL 09/19] qemu-iotests: fix case of SOCK_DIR already in the environment Max Reitz
2021-05-14 16:45 ` [PULL 10/19] Document qemu-img options data_file and data_file_raw Max Reitz
2021-05-14 16:45 ` [PULL 11/19] block/copy-on-read: use bdrv_drop_filter() and drop s->active Max Reitz
2021-05-14 16:45 ` [PULL 12/19] qemu-iotests: fix pylint 2.8 consider-using-with error Max Reitz
2021-05-14 16:45 ` [PULL 13/19] block/write-threshold: don't use write notifiers Max Reitz
2021-05-14 16:45 ` [PULL 14/19] block: drop " Max Reitz
2021-05-14 16:45 ` [PULL 15/19] test-write-threshold: rewrite test_threshold_(not_)trigger tests Max Reitz
2021-05-14 16:45 ` [PULL 16/19] block/write-threshold: drop extra APIs Max Reitz
2021-05-14 16:45 ` [PULL 17/19] test-write-threshold: drop extra tests Max Reitz
2021-05-14 16:45 ` [PULL 18/19] test-write-threshold: drop extra TestStruct structure Max Reitz
2021-05-14 16:45 ` [PULL 19/19] write-threshold: deal with includes Max Reitz
2021-05-17 12:56 ` [PULL 00/19] Block patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA_MynMjOYHmYrkGigV2hF7sFEofFW2vxZuOOs-rxk1=Bg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).