|
| From: | Vladimir Sementsov-Ogievskiy |
| Subject: | Re: [Qemu-devel] [PATCH] nbd/server: Reject 0-length block status request |
| Date: | Thu, 21 Jun 2018 15:52:49 +0300 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
21.06.2018 15:49, Eric Blake wrote:
The NBD spec says that behavior is unspecified if the client requests 0 length for block status; but since the structured reply is documenting as returning a non-zero length, it's easier to just diagnose this with an EINVAL error than to figure out what to return. CC: address@hidden Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
nbd/server.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/nbd/server.c b/nbd/server.c
index 9e1f2271784..493a926e063 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2007,6 +2007,10 @@ static coroutine_fn int nbd_handle_request(NBDClient
*client,
"discard failed", errp);
case NBD_CMD_BLOCK_STATUS:
+ if (!request->len) {
+ return nbd_send_generic_reply(client, request->handle, -EINVAL,
+ "need non-zero length", errp);
+ }
if (client->export_meta.valid && client->export_meta.base_allocation)
{
return nbd_co_send_block_status(client, request->handle,
blk_bs(exp->blk), request->from,
-- Best regards, Vladimir
| [Prev in Thread] | Current Thread | [Next in Thread] |