[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v9 07/20] block: deprecate "encryption=on" in fa
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-block] [PATCH v9 07/20] block: deprecate "encryption=on" in favor of "encrypt.format=aes" |
Date: |
Fri, 23 Jun 2017 11:08:25 +0100 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Tue, Jun 20, 2017 at 04:07:49PM +0200, Alberto Garcia wrote:
> On Tue 20 Jun 2017 02:02:06 PM CEST, Daniel P. Berrange wrote:
> >> > + if (encryptfmt) {
> >> > + buf = qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT);
> >> > + if (buf != NULL) {
> >> > + g_free(buf);
> >>
> >> If you use qemu_opt_get() instead then you don't need "buf" at all,
> >> do you?
> >
> > IIRC, we needed to delete the option from opts, otherwise something
> > will later complain that there are opts that are not consumed.
>
> I don't see how, since once you reached this point it means that you
> cannot create the image because the options are already wrong.
Ah yes, that is of course true.
> Anyway, there's a more important problem with this patch that I just
> noticed: in this scenario you're freeing 'buf' twice, first in the snip
> I quoted above, and then at the end of qcow2_create().
>
> qcow_create() from qcow.c is safe, but perhaps it's clearer if you put
> the declaration of the 'buf' variable inside the 'if (encryptfmt)'
> block.
>
> That assuming that you really need to use qemu_opt_get_del() there. With
> the double-free bug fixed, I don't see any difference when using
> qemu_opt_get_del() vs qemu_opt_get().
I'll switch to qemu_opt_get as you suggest.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [Qemu-block] [PATCH v9 05/20] iotests: skip 042 with qcow which dosn't support zero sized images, (continued)
- [Qemu-block] [PATCH v9 05/20] iotests: skip 042 with qcow which dosn't support zero sized images, Daniel P. Berrange, 2017/06/19
- [Qemu-block] [PATCH v9 06/20] iotests: skip 048 with qcow which doesn't support resize, Daniel P. Berrange, 2017/06/19
- [Qemu-block] [PATCH v9 08/20] qcow: make encrypt_sectors encrypt in place, Daniel P. Berrange, 2017/06/19
- [Qemu-block] [PATCH v9 09/20] qcow: convert QCow to use QCryptoBlock for encryption, Daniel P. Berrange, 2017/06/19
- [Qemu-block] [PATCH v9 07/20] block: deprecate "encryption=on" in favor of "encrypt.format=aes", Daniel P. Berrange, 2017/06/19
[Qemu-block] [PATCH v9 10/20] qcow2: make qcow2_encrypt_sectors encrypt in place, Daniel P. Berrange, 2017/06/19
[Qemu-block] [PATCH v9 12/20] qcow2: extend specification to cover LUKS encryption, Daniel P. Berrange, 2017/06/19
[Qemu-block] [PATCH v9 11/20] qcow2: convert QCow2 to use QCryptoBlock for encryption, Daniel P. Berrange, 2017/06/19
[Qemu-block] [PATCH v9 14/20] qcow2: add iotests to cover LUKS encryption support, Daniel P. Berrange, 2017/06/19
[Qemu-block] [PATCH v9 13/20] qcow2: add support for LUKS encryption format, Daniel P. Berrange, 2017/06/19
[Qemu-block] [PATCH v9 15/20] iotests: enable tests 134 and 158 to work with qcow (v1), Daniel P. Berrange, 2017/06/19