[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v4 04/11] nbd: Improve server handling of bogus
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [PATCH v4 04/11] nbd: Improve server handling of bogus commands |
Date: |
Tue, 14 Jun 2016 12:24:41 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 06/13/2016 06:19 AM, Paolo Bonzini wrote:
>
>
> On 12/05/2016 00:39, Eric Blake wrote:
>> We have a few bugs in how we handle invalid client commands:
>>
>> - A client can send an NBD_CMD_DISC where from + len overflows,
>> convincing us to reply with an error and stay connected, even
>> though the protocol requires us to silently disconnect. Fix by
>> hoisting the special case sooner.
>>
> It's simpler to always set req->complete. Putting everything together:
>
> diff --git a/nbd/server.c b/nbd/server.c
> @@ -1213,12 +1218,9 @@ static void nbd_trip(void *opaque)
> LOG("invalid request type (%" PRIu32 ") received", request.type);
> reply.error = EINVAL;
> error_reply:
> - /* We must disconnect after replying with an error to
> - * NBD_CMD_READ, since we choose not to send bogus filler
> - * data; likewise after NBD_CMD_WRITE if we did not read the
> - * payload. */
> - if (nbd_co_send_reply(req, &reply, 0) < 0 || command == NBD_CMD_READ
> ||
> - (command == NBD_CMD_WRITE && !req->complete)) {
> + /* We must disconnect after NBD_CMD_WRITE if we did not
> + * read the payload. */
> + if (nbd_co_send_reply(req, &reply, 0) < 0 || !req->complete)) {
This doesn't even compile (too many ')'). I assume you'll fix that
before your actual pull request goes out.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, (continued)
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Wouter Verhelst, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Wouter Verhelst, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Alex Bligh, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Paolo Bonzini, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Alex Bligh, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Paolo Bonzini, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Wouter Verhelst, 2016/06/15
- Re: [Qemu-block] [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Wouter Verhelst, 2016/06/15
Re: [Qemu-block] [PATCH v4 04/11] nbd: Improve server handling of bogus commands, Paolo Bonzini, 2016/06/13