diff options
author | Eric Blake <eblake@redhat.com> | 2016-04-06 16:48:38 -0600 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-04-08 00:07:44 +0200 |
commit | 156f6a10c21c3501aa3938badf5c3f1339c509a2 (patch) | |
tree | 14d55dbed56b9249a8ac23b1478795b4293ac735 /nbd | |
parent | 6ff5816478940c76d3412593e503f644af531d49 (diff) |
nbd: Don't kill server when client requests unknown option
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>
Message-Id: <1459982918-32229-1-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd')
-rw-r--r-- | nbd/server.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nbd/server.c b/nbd/server.c index 6d9c15a0b0..2a4dd10f52 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -483,9 +483,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 { /* |