qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hani Benhabiles <kroosec@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, kwolf@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] nbd: Don't validate from and len in NBD_CMD_DISC.
Date: Mon, 19 May 2014 22:22:56 +0100	[thread overview]
Message-ID: <20140519212256.GA21461@Inspiron-3521> (raw)
In-Reply-To: <5379E568.2020005@redhat.com>

On Mon, May 19, 2014 at 01:05:12PM +0200, Paolo Bonzini wrote:
> Il 18/05/2014 12:50, Hani Benhabiles ha scritto:
> >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 <hani@linux.com>
> >---
> > nbd.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> >diff --git a/nbd.c b/nbd.c
> >index e5084b6..dc076d7 100644
> >--- a/nbd.c
> >+++ b/nbd.c
> >@@ -1001,6 +1001,7 @@ static void nbd_trip(void *opaque)
> >     struct nbd_request request;
> >     struct nbd_reply reply;
> >     ssize_t ret;
> >+    uint32_t type;
> >
> >     TRACE("Reading request.");
> >     if (client->closing) {
> >@@ -1023,8 +1024,8 @@ static void nbd_trip(void *opaque)
> >         reply.error = -ret;
> >         goto error_reply;
> >     }
> >-
> >-    if ((request.from + request.len) > exp->size) {
> >+    type = request.type & NBD_CMD_MASK_COMMAND;
> >+    if (type != NBD_CMD_DISC && (request.from + request.len) > exp->size) {
> >             LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
> >             ", Offset: %" PRIu64 "\n",
> >                     request.from, request.len,
> >@@ -1033,7 +1034,7 @@ static void nbd_trip(void *opaque)
> >         goto invalid_request;
> >     }
> >
> >-    switch (request.type & NBD_CMD_MASK_COMMAND) {
> >+    switch (type) {
> >     case NBD_CMD_READ:
> >         TRACE("Request type is READ");
> >
> >
> 
> Applied after renaming the variable from type to command (for consistency
> with e.g. nbd_co_receive_request).

No issue. Thanks!

  reply	other threads:[~2014-05-19 21:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18 10:50 [Qemu-devel] [PATCH 1/2] nbd: Don't export a block device with no medium Hani Benhabiles
2014-05-18 10:50 ` [Qemu-devel] [PATCH 2/2] nbd: Don't validate from and len in NBD_CMD_DISC Hani Benhabiles
2014-05-19 11:05   ` Paolo Bonzini
2014-05-19 21:22     ` Hani Benhabiles [this message]
2014-05-19  8:00 ` [Qemu-devel] [Qemu-trivial] [PATCH 1/2] nbd: Don't export a block device with no medium Michael Tokarev
2014-05-19 11:03   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140519212256.GA21461@Inspiron-3521 \
    --to=kroosec@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).