[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PULL 1/4] nbd/client: fix nbd_negotiate_simple_meta_conte
From: |
Eric Blake |
Subject: |
[Qemu-stable] [PULL 1/4] nbd/client: fix nbd_negotiate_simple_meta_context |
Date: |
Fri, 4 May 2018 08:30:31 -0500 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
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.
Bug 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 <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
CC: address@hidden
Signed-off-by: Eric Blake <address@hidden>
---
nbd/client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nbd/client.c b/nbd/client.c
index b9e175d1c27..7f35b5c3232 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.14.3
- [Qemu-stable] [PULL 0/4] 2.12 post-release NBD fixes, 2018-05-04, Eric Blake, 2018/05/04
- [Qemu-stable] [PULL 3/4] nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE, Eric Blake, 2018/05/04
- [Qemu-stable] [PULL 1/4] nbd/client: fix nbd_negotiate_simple_meta_context,
Eric Blake <=
- [Qemu-stable] [PULL 2/4] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits, Eric Blake, 2018/05/04
- [Qemu-stable] [PULL 4/4] nbd/client: Relax handling of large NBD_CMD_BLOCK_STATUS reply, Eric Blake, 2018/05/04
- Re: [Qemu-stable] [Qemu-devel] [PULL 0/4] 2.12 post-release NBD fixes, 2018-05-04, Peter Maydell, 2018/05/04