mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 01:43:39 +00:00
nbd patches for 2018-05-04
- Vladimir Sementsov-Ogievskiy: 0/2 fix coverity bugs - Eric Blake: nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE - Eric Blake: nbd/client: Relax handling of large NBD_CMD_BLOCK_STATUS reply -----BEGIN PGP SIGNATURE----- Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAABCAAGBQJa7F9jAAoJEKeha0olJ0NqwZIH/3LbaF7Q0CcuB6d+nQo3jYm2 fGIb8pV4pZLgC4D4qrelXP2Ttn0RNMLNdq2UR6F66/MAFj2/sF4gRE/p82exZRK3 be2hDQpzKOTgrF7SQN9ccI1df7nrMhvXgo1Y4rhSFZKtMTBPZirDFdAP/2xklSzI jMHE/Iq9Ng16303FR5KEiVtmAWxAaagapcvEKIrD0SpoiAX9jk6dAT5EwOHLi4Lf 2CCe/5iBFC96zLE2xJ8n+esZ1chJJp/2gubmYON/lwLx5fXqYVowywDVNzv+uc8A sg2VMjb/UySOLJ6IxdxgGdln0w46RB7u55nRnyH6LcU2IdBeladhkI7Oh/reOTI= =wnw9 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-05-04' into staging nbd patches for 2018-05-04 - Vladimir Sementsov-Ogievskiy: 0/2 fix coverity bugs - Eric Blake: nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE - Eric Blake: nbd/client: Relax handling of large NBD_CMD_BLOCK_STATUS reply # gpg: Signature made Fri 04 May 2018 14:25:55 BST # gpg: using RSA key A7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" # gpg: aka "[jpeg image of size 6874]" # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2018-05-04: nbd/client: Relax handling of large NBD_CMD_BLOCK_STATUS reply nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits nbd/client: fix nbd_negotiate_simple_meta_context Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
c8b7e627b4
|
@ -259,14 +259,18 @@ static int nbd_parse_blockstatus_payload(NBDClientSession *client,
|
|||
|
||||
if (extent->length == 0 ||
|
||||
(client->info.min_block && !QEMU_IS_ALIGNED(extent->length,
|
||||
client->info.min_block)) ||
|
||||
extent->length > orig_length)
|
||||
{
|
||||
client->info.min_block))) {
|
||||
error_setg(errp, "Protocol error: server sent status chunk with "
|
||||
"invalid length");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The server is allowed to send us extra information on the final
|
||||
* extent; just clamp it to the length we requested. */
|
||||
if (extent->length > orig_length) {
|
||||
extent->length = orig_length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
18
nbd/client.c
18
nbd/client.c
|
@ -435,8 +435,8 @@ static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
|
|||
}
|
||||
be32_to_cpus(&info->min_block);
|
||||
if (!is_power_of_2(info->min_block)) {
|
||||
error_setg(errp, "server minimum block size %" PRId32
|
||||
"is not a power of two", info->min_block);
|
||||
error_setg(errp, "server minimum block size %" PRIu32
|
||||
" is not a power of two", info->min_block);
|
||||
nbd_send_opt_abort(ioc);
|
||||
return -1;
|
||||
}
|
||||
|
@ -450,8 +450,8 @@ static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
|
|||
be32_to_cpus(&info->opt_block);
|
||||
if (!is_power_of_2(info->opt_block) ||
|
||||
info->opt_block < info->min_block) {
|
||||
error_setg(errp, "server preferred block size %" PRId32
|
||||
"is not valid", info->opt_block);
|
||||
error_setg(errp, "server preferred block size %" PRIu32
|
||||
" is not valid", info->opt_block);
|
||||
nbd_send_opt_abort(ioc);
|
||||
return -1;
|
||||
}
|
||||
|
@ -462,6 +462,12 @@ static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
|
|||
return -1;
|
||||
}
|
||||
be32_to_cpus(&info->max_block);
|
||||
if (info->max_block < info->min_block) {
|
||||
error_setg(errp, "server maximum block size %" PRIu32
|
||||
" is not valid", info->max_block);
|
||||
nbd_send_opt_abort(ioc);
|
||||
return -1;
|
||||
}
|
||||
trace_nbd_opt_go_info_block_size(info->min_block, info->opt_block,
|
||||
info->max_block);
|
||||
break;
|
||||
|
@ -613,8 +619,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 +
|
||||
|
|
Loading…
Reference in a new issue