[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libguestfs] [PATCH v4 23/24] nbd/server: Prepare for per-request fi
From: |
Eric Blake |
Subject: |
Re: [Libguestfs] [PATCH v4 23/24] nbd/server: Prepare for per-request filtering of BLOCK_STATUS |
Date: |
Thu, 8 Jun 2023 14:15:56 -0500 |
User-agent: |
NeoMutt/20230517 |
On Thu, Jun 08, 2023 at 08:56:52AM -0500, Eric Blake wrote:
> The next commit will add support for the optional extension
> NBD_CMD_FLAG_PAYLOAD during NBD_CMD_BLOCK_STATUS, where the client can
> request that the server only return a subset of negotiated contexts,
> rather than all contexts. To make that task easier, this patch
> populates the list of contexts to return on a per-command basis (for
> now, identical to the full set of negotiated contexts).
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>
> +++ b/nbd/server.c
> @@ -2491,6 +2491,8 @@ static int coroutine_fn
> nbd_co_receive_request(NBDRequestData *req, NBDRequest *
> error_setg(errp, "No memory");
> return -ENOMEM;
> }
> + } else if (request->type == NBD_CMD_BLOCK_STATUS) {
> + request->contexts = &client->contexts;
> }
THere are paths where request->contexts is left NULL but request->type
was set...
> @@ -2841,6 +2848,11 @@ static coroutine_fn void nbd_trip(void *opaque)
> } else {
> ret = nbd_handle_request(client, &request, req->data, &local_err);
> }
> + if (request.type == NBD_CMD_BLOCK_STATUS &&
> + request.contexts != &client->contexts) {
> + g_free(request.contexts->bitmaps);
> + g_free(request.contexts);
> + }
so I think this also needs to be tweaked to check that
request.contexts is non-NULL before dereferencing to free bitmaps.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v4 10/24] nbd/client: Pass mode through to nbd_send_request, (continued)
- [PATCH v4 10/24] nbd/client: Pass mode through to nbd_send_request, Eric Blake, 2023/06/08
- [PATCH v4 07/24] nbd/client: Add safety check on chunk payload length, Eric Blake, 2023/06/08
- [PATCH v4 09/24] nbd: Replace bool structured_reply with mode enum, Eric Blake, 2023/06/08
- [PATCH v4 11/24] nbd: Add types for extended headers, Eric Blake, 2023/06/08
- [PATCH v4 01/24] nbd/client: Use smarter assert, Eric Blake, 2023/06/08
- [PATCH v4 23/24] nbd/server: Prepare for per-request filtering of BLOCK_STATUS, Eric Blake, 2023/06/08
- Re: [Libguestfs] [PATCH v4 23/24] nbd/server: Prepare for per-request filtering of BLOCK_STATUS,
Eric Blake <=
- [PATCH v4 24/24] nbd/server: Add FLAG_PAYLOAD support to CMD_BLOCK_STATUS, Eric Blake, 2023/06/08
- [PATCH v4 13/24] nbd/server: Refactor handling of request payload, Eric Blake, 2023/06/08
- [PATCH v4 16/24] nbd/server: Support 64-bit block status, Eric Blake, 2023/06/08
- [PATCH v4 18/24] nbd/client: Plumb errp through nbd_receive_replies, Eric Blake, 2023/06/08