8c829d0414
Remove linux-user patch which is no longer needed (bsc#1098056) OBS-URL: https://build.opensuse.org/request/show/621221 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=416
60 lines
2.6 KiB
Diff
60 lines
2.6 KiB
Diff
From 413f836f7bf230e41600945e20078f41aa21201d Mon Sep 17 00:00:00 2001
|
|
From: Eric Blake <eblake@redhat.com>
|
|
Date: Tue, 1 May 2018 10:46:53 -0500
|
|
Subject: [PATCH] nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE
|
|
|
|
A missing space makes for poor error messages, and sizes can't
|
|
go negative. Also, we missed diagnosing a server that sends
|
|
a maximum block size less than the minimum.
|
|
|
|
Fixes: 081dd1fe
|
|
CC: qemu-stable@nongnu.org
|
|
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
Message-Id: <20180501154654.943782-1-eblake@redhat.com>
|
|
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
(cherry picked from commit e475d108f1b3d3163f0affea67cdedbe5fc9752b)
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
---
|
|
nbd/client.c | 14 ++++++++++----
|
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/nbd/client.c b/nbd/client.c
|
|
index 7f35b5c323..232ff4f46d 100644
|
|
--- a/nbd/client.c
|
|
+++ b/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;
|