qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"open list:Network Block Dev..." <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PULL 3/4] nbd/server: add additional assert to nbd_export_put
Date: Wed, 20 Dec 2017 19:35:59 -0600	[thread overview]
Message-ID: <20171221013600.17648-4-eblake@redhat.com> (raw)
In-Reply-To: <20171221013600.17648-1-eblake@redhat.com>

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

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 <vsementsov@virtuozzo.com>
Message-Id: <20171109154049.42386-2-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 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

  parent reply	other threads:[~2017-12-21  1:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21  1:35 [Qemu-devel] [PULL 0/4] NBD patches through 20 Dec Eric Blake
2017-12-21  1:35 ` [Qemu-devel] [PULL 1/4] nbd/server: Implement sparse reads atop structured reply Eric Blake
2017-12-21  1:35 ` [Qemu-devel] [PULL 2/4] nbd/server: Optimize final chunk of sparse read Eric Blake
2017-12-21  1:35 ` Eric Blake [this message]
2017-12-21  1:36 ` [Qemu-devel] [PULL 4/4] qmp: add nbd-server-remove Eric Blake
2017-12-21  9:07   ` [Qemu-devel] STOP " Vladimir Sementsov-Ogievskiy
2017-12-21  9:10     ` Vladimir Sementsov-Ogievskiy
2017-12-21 14:01       ` Eric Blake
2017-12-21 13:13     ` Peter Maydell
2017-12-21 13:13 ` [Qemu-devel] [PULL 0/4] NBD patches through 20 Dec Peter Maydell

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=20171221013600.17648-4-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /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).