On 10/3/19 3:48 PM, Eric Blake wrote:
On 10/3/19 2:38 PM, Richard W.M. Jones wrote:
$ ./nbdkit -s memory 1M < fuzzing/testcase_dir/newstyle-cflags NBDMAGICIHAVEOPTnbdkit: plugins.c:274: plugin_close: Assertion `connection_get_handle (conn, 0)' failed. Aborted (core dumped)
git bisect implicates this patch:
2f80ce1209d5898cb9a567c0b29e7736ff4d03eb is the first bad commit
Yep, I see it. More patches coming (we need to better track when .open and .prepare have succeeded, so that .finalize and .close are only called on valid handles).
As a stop-gap while working on my larger patches, I'm pushing this. From 679c72d651631f5711852b7395271da834265961 Mon Sep 17 00:00:00 2001 From: Eric Blake <eblake@redhat.com> Date: Thu, 3 Oct 2019 15:55:00 -0500 Subject: [nbdkit PATCH] server: Allow plugin_close With the retry filter, we've proven that a failed reopen can leave the plugin handle unallocated. Just as filters already check for a NULL handle (see commit fd2deeb1), the plugin must now do likewise. Fixes: 2f80ce12 Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> --- server/plugins.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/plugins.c b/server/plugins.c index 727fb0e0..120e3cc2 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -270,11 +270,10 @@ static void plugin_close (struct backend *b, struct connection *conn) { struct backend_plugin *p = container_of (b, struct backend_plugin, backend); + void *handle = connection_get_handle (conn, 0); - assert (connection_get_handle (conn, 0)); - - if (p->plugin.close) - p->plugin.close (connection_get_handle (conn, 0)); + if (handle && p->plugin.close) + p->plugin.close (handle); } static int64_t -- 2.21.0 -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org