qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NA


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NAME
Date: Thu, 13 Jul 2017 09:52:14 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/07/2017 03:30 PM, Eric Blake wrote:
> Reply directly in nbd_negotiate_handle_export_name(), rather than
> waiting until nbd_negotiate_options() completes.  This will make it
> easier to implement NBD_OPT_GO.  Pass additional parameters around,
> rather than stashing things inside NBDClient.
> 
> Signed-off-by: Eric Blake <address@hidden>
> 
> ---
> v5: new patch
> ---

>  static int nbd_negotiate_handle_export_name(NBDClient *client, uint32_t 
> length,
> +                                            uint16_t myflags, bool no_zeroes,
>                                              Error **errp)
>  {
>      char name[NBD_MAX_NAME_SIZE + 1];
> +    char buf[8 + 4 + 124] = "";

Ouch, this is sized 2 bytes too large (it was copying from old-style
negotiation, which sends 4 bytes instead of 2 for the flags after the name).

> +    trace_nbd_negotiate_new_style_size_flags(client->exp->size,
> +                                             client->exp->nbdflags | 
> myflags);
> +    stq_be_p(buf, client->exp->size);
> +    stw_be_p(buf + 8, client->exp->nbdflags | myflags);
> +    len = no_zeroes ? 10 : sizeof(buf);
> +    ret = nbd_write(client->ioc, buf, len, errp);

which means we are breaking things by sending too much.

I'll submit the followup patch shortly, assuming Paolo's v1 pull request
doesn't get held up for any other reason.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]