qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: eblake@redhat.com, pbonzini@redhat.com, kwolf@redhat.com,
	mreitz@redhat.com, armbru@redhat.com, vsementsov@virtuozzo.com,
	den@openvz.org
Subject: [Qemu-devel] [PATCH 1/2] nbd/server: add additional assert to nbd_export_put
Date: Thu,  9 Nov 2017 18:40:48 +0300	[thread overview]
Message-ID: <20171109154049.42386-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20171109154049.42386-1-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>
---
 nbd/server.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nbd/server.c b/nbd/server.c
index 70b40ed27e..2f2e05943f 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1179,6 +1179,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.11.1

  reply	other threads:[~2017-11-09 15:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 15:40 [Qemu-devel] [PATCH 0/2] add qmp nbd-server-remove Vladimir Sementsov-Ogievskiy
2017-11-09 15:40 ` Vladimir Sementsov-Ogievskiy [this message]
2017-12-01 19:11   ` [Qemu-devel] [PATCH 1/2] nbd/server: add additional assert to nbd_export_put Max Reitz
2017-11-09 15:40 ` [Qemu-devel] [PATCH 2/2] qmp: add nbd-server-remove Vladimir Sementsov-Ogievskiy
2017-11-09 15:54   ` Eric Blake
2017-12-01 19:21   ` Max Reitz
2017-12-04 12:32   ` Kevin Wolf
2017-12-04 12:38     ` Vladimir Sementsov-Ogievskiy
2017-11-09 15:54 ` [Qemu-devel] [PATCH 0/2] add qmp nbd-server-remove Eric Blake

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=20171109154049.42386-2-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).