From: Paolo Bonzini <pbonzini@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/3] nbd: Reject unknown request flags
Date: Fri, 1 Apr 2016 12:47:11 +0200 [thread overview]
Message-ID: <56FE51AF.1030809@redhat.com> (raw)
In-Reply-To: <1459459222-8637-4-git-send-email-eblake@redhat.com>
On 31/03/2016 23:20, Eric Blake wrote:
> The NBD protocol says that clients should not send a command flag
> that has not been negotiated (whether by the client requesting an
> option during a handshake, or because we advertise support for the
> flag in response to NBD_OPT_EXPORT_NAME), and that servers should
> reject invalid flags with EINVAL. We were silently ignoring the
> flags instead. The client can't rely on our behavior, since it is
> their fault for passing the bad flag in the first place, but it's
> better to be robust up front than to possibly behave differently
> than the client was expecting with the attempted flag.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> nbd/server.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/nbd/server.c b/nbd/server.c
> index a590773..31bd9c5 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -974,6 +974,10 @@ static ssize_t nbd_co_receive_request(NBDRequest *req, struct nbd_request *reque
> goto out;
> }
>
> + if (request->flags & ~NBD_CMD_FLAG_FUA) {
> + LOG("unsupported flags (got 0x%x)", request->flags);
> + return -EINVAL;
> + }
> if ((request->from + request->len) < request->from) {
> LOG("integer overflow detected! "
> "you're probably being attacked");
>
Queued for 2.6.
Paolo
prev parent reply other threads:[~2016-04-01 10:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 21:20 [Qemu-devel] [PATCH 0/3] NBD: flag handling cleanup Eric Blake
2016-03-31 21:20 ` [Qemu-devel] [PATCH 1/3] nbd: Treat flags vs. command type as separate fields Eric Blake
2016-03-31 21:20 ` [Qemu-devel] [PATCH 2/3] nbd: Fix poor debug message Eric Blake
2016-04-01 10:47 ` Paolo Bonzini
2016-03-31 21:20 ` [Qemu-devel] [PATCH 3/3] nbd: Reject unknown request flags Eric Blake
2016-04-01 10:47 ` Paolo Bonzini [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=56FE51AF.1030809@redhat.com \
--to=pbonzini@redhat.com \
--cc=eblake@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.