mirror of https://github.com/xemu-project/xemu.git
nbd: Don't validate from and len in NBD_CMD_DISC.
These values aren't used in this case. Currently, the from field in the request sent by the nbd kernel module leading to a false error message when ending the connection with the client. $ qemu-nbd some.img -v // After nbd-client -d /dev/nbd0 nbd.c:nbd_trip():L1031: From: 18446744073709551104, Len: 0, Size: 20971520, Offset: 0 nbd.c:nbd_trip():L1032: requested operation past EOF--bad client? nbd.c:nbd_receive_request():L638: read failed Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
60fe4fac22
commit
8c5d1abbb7
7
nbd.c
7
nbd.c
|
@ -1001,6 +1001,7 @@ static void nbd_trip(void *opaque)
|
||||||
struct nbd_request request;
|
struct nbd_request request;
|
||||||
struct nbd_reply reply;
|
struct nbd_reply reply;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
uint32_t command;
|
||||||
|
|
||||||
TRACE("Reading request.");
|
TRACE("Reading request.");
|
||||||
if (client->closing) {
|
if (client->closing) {
|
||||||
|
@ -1023,8 +1024,8 @@ static void nbd_trip(void *opaque)
|
||||||
reply.error = -ret;
|
reply.error = -ret;
|
||||||
goto error_reply;
|
goto error_reply;
|
||||||
}
|
}
|
||||||
|
command = request.type & NBD_CMD_MASK_COMMAND;
|
||||||
if ((request.from + request.len) > exp->size) {
|
if (command != NBD_CMD_DISC && (request.from + request.len) > exp->size) {
|
||||||
LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
|
LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
|
||||||
", Offset: %" PRIu64 "\n",
|
", Offset: %" PRIu64 "\n",
|
||||||
request.from, request.len,
|
request.from, request.len,
|
||||||
|
@ -1033,7 +1034,7 @@ static void nbd_trip(void *opaque)
|
||||||
goto invalid_request;
|
goto invalid_request;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (request.type & NBD_CMD_MASK_COMMAND) {
|
switch (command) {
|
||||||
case NBD_CMD_READ:
|
case NBD_CMD_READ:
|
||||||
TRACE("Request type is READ");
|
TRACE("Request type is READ");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue