On Thu 26 Jan 2017 11:18:20 AM CET, "Daniel P. Berrange" <berra...@redhat.com> 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