On Wed, Feb 08, 2017 at 05:15:34PM +0100, Alberto Garcia wrote: > 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?
Yep, I think this was left over from an earlier version of the patch series where I had already validated crypto_method_header. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|