From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, alex@alex.org.uk,
qemu-stable <qemu-stable@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 2/1 for-2.6] nbd: Don't kill server when client requests unknown option
Date: Sat, 9 Apr 2016 16:41:44 -0600 [thread overview]
Message-ID: <57098528.7040008@redhat.com> (raw)
In-Reply-To: <1459982918-32229-1-git-send-email-eblake@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2160 bytes --]
Adding qemu-stable; this fix needs to be backported to 2.5.x stable
series (in the file ./nbd.c at the time), if we want to be able to allow
a 2.7 client to connect to a 2.5 server.
On 04/06/2016 04:48 PM, Eric Blake wrote:
> nbd-server.c currently fails to handle unsupported options properly.
> If during option haggling the client sends an unknown request, the
> server kills the connection instead of letting the client try to
> fall back to something older. This is precisely what advertising
> NBD_FLAG_FIXED_NEWSTYLE was supposed to fix.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>
> Turns out our server has a very similar bug to the client.
> If desired, I can spin a v3 that moves the hunk in nbd/client.c
> to the previous patch.
>
> nbd/client.c | 2 ++
> nbd/server.c | 5 ++++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/nbd/client.c b/nbd/client.c
> index 67116b9..fc382c5 100644
> --- a/nbd/client.c
> +++ b/nbd/client.c
> @@ -109,6 +109,8 @@ static int nbd_handle_reply_err(QIOChannel *ioc, uint32_t opt, uint32_t type,
>
> switch (type) {
> case NBD_REP_ERR_UNSUP:
> + TRACE("server doesn't understand request %d, attempting fallback",
> + opt);
> result = 0;
> goto cleanup;
>
> diff --git a/nbd/server.c b/nbd/server.c
> index b95571b..7843584 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -482,9 +482,12 @@ static int nbd_negotiate_options(NBDClient *client)
> return -EINVAL;
> default:
> TRACE("Unsupported option 0x%x", clientflags);
> + if (nbd_negotiate_drop_sync(client->ioc, length) != length) {
> + return -EIO;
> + }
> nbd_negotiate_send_rep(client->ioc, NBD_REP_ERR_UNSUP,
> clientflags);
> - return -EINVAL;
> + break;
> }
> } else {
> /*
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
prev parent reply other threads:[~2016-04-09 22:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 16:59 [Qemu-devel] [PATCH v2] nbd: Fix NBD unsupported options Eric Blake
2016-04-06 22:48 ` [Qemu-devel] [PATCH v2 2/1 for-2.6] nbd: Don't kill server when client requests unknown option Eric Blake
2016-04-07 8:50 ` Paolo Bonzini
2016-04-09 22:41 ` Eric Blake [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=57098528.7040008@redhat.com \
--to=eblake@redhat.com \
--cc=alex@alex.org.uk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).