qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Avoid memleak on qcow2 image info failure
@ 2020-03-20 18:36 Eric Blake
  2020-03-23  6:51 ` Vladimir Sementsov-Ogievskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Blake @ 2020-03-20 18:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, peter.maydell, Max Reitz, open list:qcow2, andrey.shinkevich

If we fail to get bitmap info, we must not leak the encryption info.

Fixes: b8968c875f403
Fixes: Coverity CID 1421894
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/qcow2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qcow2.c b/block/qcow2.c
index d44b45633dbb..e08917ed8462 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -4811,6 +4811,7 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs,
         if (local_err) {
             error_propagate(errp, local_err);
             qapi_free_ImageInfoSpecific(spec_info);
+            qapi_free_QCryptoBlockInfo(encrypt_info);
             return NULL;
         }
         *spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: Avoid memleak on qcow2 image info failure
  2020-03-20 18:36 [PATCH] block: Avoid memleak on qcow2 image info failure Eric Blake
@ 2020-03-23  6:51 ` Vladimir Sementsov-Ogievskiy
  2020-03-23 11:41 ` Andrey Shinkevich
  2020-03-23 13:33 ` Max Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-03-23  6:51 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Kevin Wolf, peter.maydell, andrey.shinkevich, open list:qcow2, Max Reitz

20.03.2020 21:36, Eric Blake wrote:
> If we fail to get bitmap info, we must not leak the encryption info.
> 
> Fixes: b8968c875f403
> Fixes: Coverity CID 1421894
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>   block/qcow2.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index d44b45633dbb..e08917ed8462 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -4811,6 +4811,7 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs,
>           if (local_err) {
>               error_propagate(errp, local_err);
>               qapi_free_ImageInfoSpecific(spec_info);
> +            qapi_free_QCryptoBlockInfo(encrypt_info);
>               return NULL;
>           }
>           *spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
> 


Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

-- 
Best regards,
Vladimir


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: Avoid memleak on qcow2 image info failure
  2020-03-20 18:36 [PATCH] block: Avoid memleak on qcow2 image info failure Eric Blake
  2020-03-23  6:51 ` Vladimir Sementsov-Ogievskiy
@ 2020-03-23 11:41 ` Andrey Shinkevich
  2020-03-23 13:33 ` Max Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Shinkevich @ 2020-03-23 11:41 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Kevin Wolf, peter.maydell, open list:qcow2, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 861 bytes --]



________________________________
From: Eric Blake <eblake@redhat.com>
Sent: Friday, March 20, 2020 9:36 PM
To: qemu-devel@nongnu.org <qemu-devel@nongnu.org>
Cc: peter.maydell@linaro.org <peter.maydell@linaro.org>; Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>; Kevin Wolf <kwolf@redhat.com>; Max Reitz <mreitz@redhat.com>; open list:qcow2 <qemu-block@nongnu.org>
Subject: [PATCH] block: Avoid memleak on qcow2 image info failure

If we fail to get bitmap info, we must not leak the encryption info.

Fixes: b8968c875f403
Fixes: Coverity CID 1421894
Signed-off-by: Eric Blake <eblake@redhat.com>
---

Thank you Eric.
I have made a smoke test only without the crypto object instantiation.

Andrey


Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>

Tested-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>


[-- Attachment #2: Type: text/html, Size: 3670 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: Avoid memleak on qcow2 image info failure
  2020-03-20 18:36 [PATCH] block: Avoid memleak on qcow2 image info failure Eric Blake
  2020-03-23  6:51 ` Vladimir Sementsov-Ogievskiy
  2020-03-23 11:41 ` Andrey Shinkevich
@ 2020-03-23 13:33 ` Max Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2020-03-23 13:33 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Kevin Wolf, peter.maydell, open list:qcow2, andrey.shinkevich


[-- Attachment #1.1: Type: text/plain, Size: 393 bytes --]

On 20.03.20 19:36, Eric Blake wrote:
> If we fail to get bitmap info, we must not leak the encryption info.
> 
> Fixes: b8968c875f403
> Fixes: Coverity CID 1421894
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  block/qcow2.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-23 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 18:36 [PATCH] block: Avoid memleak on qcow2 image info failure Eric Blake
2020-03-23  6:51 ` Vladimir Sementsov-Ogievskiy
2020-03-23 11:41 ` Andrey Shinkevich
2020-03-23 13:33 ` Max Reitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).