qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 3/4] nbd/server: add additional assert to nbd_export_


From: Eric Blake
Subject: [Qemu-devel] [PULL 3/4] nbd/server: add additional assert to nbd_export_put
Date: Wed, 20 Dec 2017 19:35:59 -0600

From: Vladimir Sementsov-Ogievskiy <address@hidden>

This place is not obvious, nbd_export_close may theoretically reduce
refcount to 0. It may happen if someone calls nbd_export_put on named
export not through nbd_export_set_name when refcount is 1.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
 nbd/server.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nbd/server.c b/nbd/server.c
index e443b3cf5c..a6d7c24663 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1190,6 +1190,7 @@ void nbd_export_put(NBDExport *exp)
         nbd_export_close(exp);
     }

+    assert(exp->refcount > 0);
     if (--exp->refcount == 0) {
         assert(exp->name == NULL);
         assert(exp->description == NULL);
-- 
2.14.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]