qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-block] [PATCH v3 11/18] qcow2: convert QCow2 to u


From: Alberto Garcia
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v3 11/18] qcow2: convert QCow2 to use QCryptoBlock for encryption
Date: Wed, 08 Feb 2017 17:15:34 +0100
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Thu 26 Jan 2017 11:18:20 AM CET, "Daniel P. Berrange" <address@hidden> wrote:

> @@ -751,6 +757,23 @@ static int qcow2_update_options_prepare(BlockDriverState 
> *bs,
>      r->discard_passthrough[QCOW2_DISCARD_OTHER] =
>          qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false);
>  
> +    switch (s->crypt_method_header) {
> +    case QCOW_CRYPT_NONE:
> +        break;
> +
> +    case QCOW_CRYPT_AES:
> +        r->crypto_opts = block_crypto_open_opts_init(
> +            Q_CRYPTO_BLOCK_FORMAT_QCOW, opts, "aes-", errp);
> +        break;
> +
> +    default:
> +        g_assert_not_reached();

This crashes QEMU if the qcow2 file uses an different method (or is
corrupted).

> +    }
> +    if (s->crypt_method_header && !r->crypto_opts) {
> +        ret = -EINVAL;
> +        goto fail;
> +    }

Shouldn't you remove the assertion and set errp here to "Unsupported
encryption method" instead?

Berto



reply via email to

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