qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.11] nbd: Don't crash when server reports NBD_CMD_READ failure
@ 2017-11-12  1:39 Eric Blake
  2017-11-13 11:37 ` Vladimir Sementsov-Ogievskiy
  2017-11-13 18:20 ` Eric Blake
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Blake @ 2017-11-12  1:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, vsementsov, Paolo Bonzini, Kevin Wolf, Max Reitz

If a server fails a read, for example with EIO, but the connection
is still live, then we would crash trying to print a non-existent
error message.  Bug introduced in commit f140e300.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/nbd-client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/nbd-client.c b/block/nbd-client.c
index b44d4d4a01..5f3375a970 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -78,7 +78,7 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)
     while (!s->quit) {
         assert(s->reply.handle == 0);
         ret = nbd_receive_reply(s->ioc, &s->reply, &local_err);
-        if (ret < 0) {
+        if (local_err) {
             error_report_err(local_err);
         }
         if (ret <= 0) {
@@ -681,7 +681,7 @@ int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,

     ret = nbd_co_receive_cmdread_reply(client, request.handle, offset, qiov,
                                        &local_err);
-    if (ret < 0) {
+    if (local_err) {
         error_report_err(local_err);
     }
     return ret;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-13 18:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-12  1:39 [Qemu-devel] [PATCH for-2.11] nbd: Don't crash when server reports NBD_CMD_READ failure Eric Blake
2017-11-13 11:37 ` Vladimir Sementsov-Ogievskiy
2017-11-13 14:45   ` Eric Blake
2017-11-13 14:55     ` Vladimir Sementsov-Ogievskiy
2017-11-13 18:20 ` Eric Blake

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).