From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] blockdev: Fix NULL pointer dereference in blockdev-add
Date: Thu, 6 Mar 2014 17:06:41 +0100 [thread overview]
Message-ID: <20140306160641.GE22291@irqsave.net> (raw)
In-Reply-To: <1394120669-4675-3-git-send-email-kwolf@redhat.com>
The Thursday 06 Mar 2014 à 16:44:28 (+0100), Kevin Wolf wrote :
> If aio=native, we check that cache.direct is set as well. If however
> cache wasn't specified at all, qemu just segfaulted.
>
> The old condition didn't make any sense anyway because it effectively
> only checked for the default cache mode case, but not for an explicitly
> set cache.direct=off mode.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> blockdev.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 561cb81..c3422a1 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2283,8 +2283,10 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
> *
> * For now, simply forbidding the combination for all drivers will do. */
> if (options->has_aio && options->aio == BLOCKDEV_AIO_OPTIONS_NATIVE) {
> - bool direct = options->cache->has_direct && options->cache->direct;
> - if (!options->has_cache && !direct) {
> + bool direct = options->has_cache &&
> + options->cache->has_direct &&
> + options->cache->direct;
> + if (!direct) {
> error_setg(errp, "aio=native requires cache.direct=true");
> goto fail;
> }
> --
> 1.8.1.4
>
>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
next prev parent reply other threads:[~2014-03-06 16:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 15:44 [Qemu-devel] [PATCH 0/3] blockdev: blockdev-add error path fixes and tests Kevin Wolf
2014-03-06 15:44 ` [Qemu-devel] [PATCH 1/3] blockdev: Fail blockdev-add with encrypted images Kevin Wolf
2014-03-06 16:02 ` Benoît Canet
2014-03-06 16:21 ` Eric Blake
2014-03-06 15:44 ` [Qemu-devel] [PATCH 2/3] blockdev: Fix NULL pointer dereference in blockdev-add Kevin Wolf
2014-03-06 16:06 ` Benoît Canet [this message]
2014-03-06 16:22 ` Eric Blake
2014-03-06 15:44 ` [Qemu-devel] [PATCH 3/3] qemu-iotests: Test a few blockdev-add error cases Kevin Wolf
2014-03-06 16:13 ` Benoît Canet
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=20140306160641.GE22291@irqsave.net \
--to=benoit.canet@irqsave.net \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.