All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, alex@alex.org.uk
Subject: Re: [Qemu-devel] [PATCH for-2.6] nbd: Don't fail handshake on NBD_OPT_LIST descriptions
Date: Fri, 15 Apr 2016 00:21:21 +0200	[thread overview]
Message-ID: <571017E1.1040303@redhat.com> (raw)
In-Reply-To: <5710149D.5090803@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2525 bytes --]

On 15.04.2016 00:07, Eric Blake wrote:
> On 04/14/2016 03:31 PM, Max Reitz wrote:
>> On 08.04.2016 03:09, Eric Blake wrote:
>>> The NBD Protocol states that NBD_REP_SERVER may set
>>> 'length > sizeof(namelen) + namelen'; in which case the rest
>>> of the packet is a UTF-8 description of the export.  While we
>>> don't know of any NBD servers that send this description yet,
>>> we had better consume the data so we don't choke when we start
>>> to talk to such a server.
>>>
> 
>>> @@ -214,6 +219,20 @@ static int nbd_receive_list(QIOChannel *ioc, char **name, Error **errp)
>>>              return -1;
>>>          }
>>>          (*name)[namelen] = '\0';
>>> +        len -= namelen;
>>> +        if (len) {
>>> +            char *buf = g_malloc(len + 1);
>>> +            if (read_sync(ioc, buf, len) != len) {
>>> +                error_setg(errp, "failed to read export description");
>>> +                g_free(*name);
>>> +                g_free(buf);
>>> +                *name = NULL;
>>> +                return -1;
>>> +            }
>>> +            buf[len] = '\0';
>>> +            TRACE("Ignoring export description: %s", buf);
>>
>> I find this funny, somehow.
>>
>> Perhaps it's because this may explicitly print something while
>> explaining that it's being ignored.
> 
> The server.c code had a nice function for skipping unwanted bytes;

I know; I added it. ;-)

>                                                                    and
> in a 2.7 series, I borrowed that idea:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg01597.html
> 
> but for the purpose of minimal churn in 2.6, I don't mind the
> (temporary) oddity.

Yeah, I didn't mean funny in the "why is that here" sense, but in the "I
chuckled a little" sense. :-)

>>> +            g_free(buf);
>>> +        }
>>>      } else {
>>>          error_setg(errp, "Unexpected reply type %x expected %x",
>>>                     type, NBD_REP_SERVER);
>>>
>>
>> Thanks Eric, I applied this patch to my block branch (for 2.6). If this
>> was not your intention, please speak up. :-)
>>
>> https://github.com/XanClic/qemu/commits/block
> 
> You did the right thing.

That phrasing makes me feel a little uncomfortable. It's a phrase I'd
expect to hear after I have committed a deed of questionable morality,
which was right only in the greater scheme of things and for the
well-being of the many. So now I'm a bit worried. :-)

(Just kidding, of course.)

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2016-04-14 22:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  1:09 [Qemu-devel] [PATCH for-2.6] nbd: Don't fail handshake on NBD_OPT_LIST descriptions Eric Blake
2016-04-08  5:51 ` Alex Bligh
2016-04-08 13:52   ` Eric Blake
2016-04-14 15:26 ` Eric Blake
2016-04-14 15:46   ` Alex Bligh
2016-04-14 21:31 ` Max Reitz
2016-04-14 22:07   ` Eric Blake
2016-04-14 22:21     ` Max Reitz [this message]

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=571017E1.1040303@redhat.com \
    --to=mreitz@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.