diff options
author | Eric Blake <eblake@redhat.com> | 2018-11-17 16:32:21 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2018-11-19 11:16:46 -0600 |
commit | 3e99ebb9d3df15ce0ecf1b435816c9c46ee9a1ad (patch) | |
tree | 24d530b69e1ce880d55514f9769a68edd0aff767 /nbd/server.c | |
parent | 0b0bb124bb797b2fc3389ffa1e933fc34fe6dacb (diff) | |
download | qemu-3e99ebb9d3df15ce0ecf1b435816c9c46ee9a1ad.zip qemu-3e99ebb9d3df15ce0ecf1b435816c9c46ee9a1ad.tar.gz qemu-3e99ebb9d3df15ce0ecf1b435816c9c46ee9a1ad.tar.bz2 |
nbd/server: Ignore write errors when replying to NBD_OPT_ABORT
Commit 37ec36f6 intentionally ignores errors when trying to reply
to an NBD_OPT_ABORT request for plaintext clients, but did not make
the same change for a TLS server. Since NBD_OPT_ABORT is
documented as being a potential for an EPIPE when the client hangs
up without waiting for our reply, we don't need to pollute the
server's output with that failure.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181117223221.2198751-1-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'nbd/server.c')
-rw-r--r-- | nbd/server.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/nbd/server.c b/nbd/server.c index 056cfa5..dc04513 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1134,12 +1134,16 @@ static int nbd_negotiate_options(NBDClient *client, uint16_t myflags, return -EINVAL; default: - ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD, errp, + /* Let the client keep trying, unless they asked to + * quit. Always try to give an error back to the + * client; but when replying to OPT_ABORT, be aware + * that the client may hang up before receiving the + * error, in which case we are fine ignoring the + * resulting EPIPE. */ + ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD, + option == NBD_OPT_ABORT ? NULL : errp, "Option 0x%" PRIx32 " not permitted before TLS", option); - /* Let the client keep trying, unless they asked to - * quit. In this mode, we've already sent an error, so - * we can't ack the abort. */ if (option == NBD_OPT_ABORT) { return 1; } |