Blame SOURCES/kvm-nbd-client-fix-nbd_negotiate_simple_meta_context.patch

7711c0
From 8f9f560d48befb6c527e876347d883f8ed3c128a Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Fri, 22 Mar 2019 03:22:14 +0100
7711c0
Subject: [PATCH 047/163] nbd/client: fix nbd_negotiate_simple_meta_context
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190322032241.8111-2-jsnow@redhat.com>
7711c0
Patchwork-id: 85092
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 01/28] nbd/client: fix nbd_negotiate_simple_meta_context
7711c0
Bugzilla: 1691563
7711c0
RH-Acked-by: Richard Jones <rjones@redhat.com>
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
7711c0
Initialize received variable. Otherwise, is is possible for server to
7711c0
answer without any contexts, but we will set context_id to something
7711c0
random (received_id is not initialized too) and return 1, which is
7711c0
wrong.
7711c0
7711c0
To solve it, just initialize received to false. Initialize received_id
7711c0
too, just to make all possible checkers happy.
7711c0
7711c0
Bug was introduced in 78a33ab58782efdb206de14 "nbd: BLOCK_STATUS for
7711c0
standard get_block_status function: client part" with the whole
7711c0
function.
7711c0
7711c0
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
Message-Id: <20180427142002.21930-2-vsementsov@virtuozzo.com>
7711c0
Reviewed-by: Eric Blake <eblake@redhat.com>
7711c0
CC: qemu-stable@nongnu.org
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
(cherry picked from commit 89aa0d87634e2cb98517509dc8bdb876f26ecf8b)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 nbd/client.c | 4 ++--
7711c0
 1 file changed, 2 insertions(+), 2 deletions(-)
7711c0
7711c0
diff --git a/nbd/client.c b/nbd/client.c
7711c0
index 25603f2..a151fa5 100644
7711c0
--- a/nbd/client.c
7711c0
+++ b/nbd/client.c
7711c0
@@ -613,8 +613,8 @@ static int nbd_negotiate_simple_meta_context(QIOChannel *ioc,
7711c0
 {
7711c0
     int ret;
7711c0
     NBDOptionReply reply;
7711c0
-    uint32_t received_id;
7711c0
-    bool received;
7711c0
+    uint32_t received_id = 0;
7711c0
+    bool received = false;
7711c0
     uint32_t export_len = strlen(export);
7711c0
     uint32_t context_len = strlen(context);
7711c0
     uint32_t data_len = sizeof(export_len) + export_len +
7711c0
-- 
7711c0
1.8.3.1
7711c0