|
|
ff9ada |
From d5a85fcf996948d1154e88e9ee3b4e8c64ec2694 Mon Sep 17 00:00:00 2001
|
|
|
ff9ada |
From: Hanna Reitz <hreitz@redhat.com>
|
|
|
ff9ada |
Date: Fri, 4 Feb 2022 12:10:08 +0100
|
|
|
ff9ada |
Subject: [PATCH 2/6] block/nbd: Assert there are no timers when closed
|
|
|
ff9ada |
|
|
|
ff9ada |
RH-Author: Hanna Reitz <hreitz@redhat.com>
|
|
|
ff9ada |
RH-MergeRequest: 117: block/nbd: Handle AioContext changes
|
|
|
ff9ada |
RH-Commit: [2/6] 995795ae9844a7d2b28cb1e57fd7fe81482d0205
|
|
|
ff9ada |
RH-Bugzilla: 2035185
|
|
|
ff9ada |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ff9ada |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
ff9ada |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ff9ada |
|
|
|
ff9ada |
Our two timers must not remain armed beyond nbd_clear_bdrvstate(), or
|
|
|
ff9ada |
they will access freed data when they fire.
|
|
|
ff9ada |
|
|
|
ff9ada |
This patch is separate from the patches that actually fix the issue
|
|
|
ff9ada |
(HEAD^^ and HEAD^) so that you can run the associated regression iotest
|
|
|
ff9ada |
(281) on a configuration that reproducibly exposes the bug.
|
|
|
ff9ada |
|
|
|
ff9ada |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
ff9ada |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
ff9ada |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
ff9ada |
(cherry picked from commit 8a39c381e5e407d2fe5500324323f90a8540fa90)
|
|
|
ff9ada |
|
|
|
ff9ada |
Conflict:
|
|
|
ff9ada |
- block/nbd.c: open_timer was introduced after the 6.2 release (for
|
|
|
ff9ada |
nbd's @open-timeout parameter), and has not been backported, so drop
|
|
|
ff9ada |
the assertion that it is NULL
|
|
|
ff9ada |
|
|
|
ff9ada |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
ff9ada |
---
|
|
|
ff9ada |
block/nbd.c | 3 +++
|
|
|
ff9ada |
1 file changed, 3 insertions(+)
|
|
|
ff9ada |
|
|
|
ff9ada |
diff --git a/block/nbd.c b/block/nbd.c
|
|
|
ff9ada |
index b8e5a9b4cc..aab20125d8 100644
|
|
|
ff9ada |
--- a/block/nbd.c
|
|
|
ff9ada |
+++ b/block/nbd.c
|
|
|
ff9ada |
@@ -108,6 +108,9 @@ static void nbd_clear_bdrvstate(BlockDriverState *bs)
|
|
|
ff9ada |
|
|
|
ff9ada |
yank_unregister_instance(BLOCKDEV_YANK_INSTANCE(bs->node_name));
|
|
|
ff9ada |
|
|
|
ff9ada |
+ /* Must not leave timers behind that would access freed data */
|
|
|
ff9ada |
+ assert(!s->reconnect_delay_timer);
|
|
|
ff9ada |
+
|
|
|
ff9ada |
object_unref(OBJECT(s->tlscreds));
|
|
|
ff9ada |
qapi_free_SocketAddress(s->saddr);
|
|
|
ff9ada |
s->saddr = NULL;
|
|
|
ff9ada |
--
|
|
|
ff9ada |
2.27.0
|
|
|
ff9ada |
|