qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] fix coverity bugs
@ 2018-04-27 14:20 Vladimir Sementsov-Ogievskiy
  2018-04-27 14:20 ` [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context Vladimir Sementsov-Ogievskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-04-27 14:20 UTC (permalink / raw)
  To: qemu-devel, qemu-block, qemu-stable
  Cc: eblake, pbonzini, dgilbert, quintela, famz, stefanha, vsementsov,
	den, peter.maydell

Hi all.

Here are two bug fixes, thanks to Peter for reporting.

Both are introduced in 2.12.

Vladimir Sementsov-Ogievskiy (2):
  nbd/client: fix nbd_negotiate_simple_meta_context
  migration/block-dirty-bitmap: fix memory leak in
    dirty_bitmap_load_bits

 migration/block-dirty-bitmap.c | 1 +
 nbd/client.c                   | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.11.1

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

* [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context
  2018-04-27 14:20 [Qemu-devel] [PATCH 0/2] fix coverity bugs Vladimir Sementsov-Ogievskiy
@ 2018-04-27 14:20 ` Vladimir Sementsov-Ogievskiy
  2018-04-27 15:20   ` Eric Blake
  2018-04-27 14:20 ` [Qemu-devel] [PATCH 2/2] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits Vladimir Sementsov-Ogievskiy
  2018-04-27 15:19 ` [Qemu-devel] [PATCH 0/2] fix coverity bugs Eric Blake
  2 siblings, 1 reply; 5+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-04-27 14:20 UTC (permalink / raw)
  To: qemu-devel, qemu-block, qemu-stable
  Cc: eblake, pbonzini, dgilbert, quintela, famz, stefanha, vsementsov,
	den, peter.maydell

Initialize received variable. Otherwise, is is possible for server to
answer without any contexts, but we will set context_id to something
random (received_id is not initialized too) and return 1, which is
wrong.

To solve it, just initialize received to false. Initialize received_id
too, just to make all possible checkers happy.

But was introduced in 78a33ab58782efdb206de14 "nbd: BLOCK_STATUS for
standard get_block_status function: client part" with the whole
function.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 nbd/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nbd/client.c b/nbd/client.c
index b9e175d1c2..7f35b5c323 100644
--- a/nbd/client.c
+++ b/nbd/client.c
@@ -613,8 +613,8 @@ static int nbd_negotiate_simple_meta_context(QIOChannel *ioc,
 {
     int ret;
     NBDOptionReply reply;
-    uint32_t received_id;
-    bool received;
+    uint32_t received_id = 0;
+    bool received = false;
     uint32_t export_len = strlen(export);
     uint32_t context_len = strlen(context);
     uint32_t data_len = sizeof(export_len) + export_len +
-- 
2.11.1

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

* [Qemu-devel] [PATCH 2/2] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits
  2018-04-27 14:20 [Qemu-devel] [PATCH 0/2] fix coverity bugs Vladimir Sementsov-Ogievskiy
  2018-04-27 14:20 ` [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context Vladimir Sementsov-Ogievskiy
@ 2018-04-27 14:20 ` Vladimir Sementsov-Ogievskiy
  2018-04-27 15:19 ` [Qemu-devel] [PATCH 0/2] fix coverity bugs Eric Blake
  2 siblings, 0 replies; 5+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-04-27 14:20 UTC (permalink / raw)
  To: qemu-devel, qemu-block, qemu-stable
  Cc: eblake, pbonzini, dgilbert, quintela, famz, stefanha, vsementsov,
	den, peter.maydell

Release buf on error path too.

Bug was introduced in b35ebdf076d697bc "migration: add postcopy
migration of dirty bitmaps" with the whole function.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 migration/block-dirty-bitmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index dd04f102d8..8819aabe3a 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -600,6 +600,7 @@ static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s)
         ret = qemu_get_buffer(f, buf, buf_size);
         if (ret != buf_size) {
             error_report("Failed to read bitmap bits");
+            g_free(buf);
             return -EIO;
         }
 
-- 
2.11.1

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

* Re: [Qemu-devel] [PATCH 0/2] fix coverity bugs
  2018-04-27 14:20 [Qemu-devel] [PATCH 0/2] fix coverity bugs Vladimir Sementsov-Ogievskiy
  2018-04-27 14:20 ` [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context Vladimir Sementsov-Ogievskiy
  2018-04-27 14:20 ` [Qemu-devel] [PATCH 2/2] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits Vladimir Sementsov-Ogievskiy
@ 2018-04-27 15:19 ` Eric Blake
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2018-04-27 15:19 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy, qemu-devel, qemu-block, qemu-stable
  Cc: pbonzini, dgilbert, quintela, famz, stefanha, den, peter.maydell

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

On 04/27/2018 09:20 AM, Vladimir Sementsov-Ogievskiy wrote:
> Hi all.
> 
> Here are two bug fixes, thanks to Peter for reporting.
> 
> Both are introduced in 2.12.
> 
> Vladimir Sementsov-Ogievskiy (2):
>   nbd/client: fix nbd_negotiate_simple_meta_context
>   migration/block-dirty-bitmap: fix memory leak in
>     dirty_bitmap_load_bits

Reviewed-by: Eric Blake <eblake@redhat.com>

Adding both to my NBD queue

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


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

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

* Re: [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context
  2018-04-27 14:20 ` [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context Vladimir Sementsov-Ogievskiy
@ 2018-04-27 15:20   ` Eric Blake
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2018-04-27 15:20 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy, qemu-devel, qemu-block, qemu-stable
  Cc: pbonzini, dgilbert, quintela, famz, stefanha, den, peter.maydell

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

On 04/27/2018 09:20 AM, Vladimir Sementsov-Ogievskiy wrote:
> Initialize received variable. Otherwise, is is possible for server to
> answer without any contexts, but we will set context_id to something
> random (received_id is not initialized too) and return 1, which is
> wrong.
> 
> To solve it, just initialize received to false. Initialize received_id
> too, just to make all possible checkers happy.
> 
> But was introduced in 78a33ab58782efdb206de14 "nbd: BLOCK_STATUS for

s/But/Bug/

> standard get_block_status function: client part" with the whole
> function.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  nbd/client.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


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

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

end of thread, other threads:[~2018-04-27 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-27 14:20 [Qemu-devel] [PATCH 0/2] fix coverity bugs Vladimir Sementsov-Ogievskiy
2018-04-27 14:20 ` [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context Vladimir Sementsov-Ogievskiy
2018-04-27 15:20   ` Eric Blake
2018-04-27 14:20 ` [Qemu-devel] [PATCH 2/2] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits Vladimir Sementsov-Ogievskiy
2018-04-27 15:19 ` [Qemu-devel] [PATCH 0/2] fix coverity bugs Eric Blake

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).