aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nbd/client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/nbd/client.c b/nbd/client.c
index de7da48246..427980bdd2 100644
--- a/nbd/client.c
+++ b/nbd/client.c
@@ -426,6 +426,14 @@ static int nbd_opt_info_or_go(QIOChannel *ioc, uint32_t opt,
nbd_send_opt_abort(ioc);
return -1;
}
+ if (info->min_block &&
+ !QEMU_IS_ALIGNED(info->size, info->min_block)) {
+ error_setg(errp, "export size %" PRIu64 "is not multiple of "
+ "minimum block size %" PRIu32, info->size,
+ info->min_block);
+ nbd_send_opt_abort(ioc);
+ return -1;
+ }
trace_nbd_receive_negotiate_size_flags(info->size, info->flags);
break;