[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 3/7] block/nbd: Assert there are no timers when closed
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PULL v2 3/7] block/nbd: Assert there are no timers when closed |
Date: |
Fri, 11 Feb 2022 14:22:36 +0100 |
From: Hanna Reitz <hreitz@redhat.com>
Our two timers must not remain armed beyond nbd_clear_bdrvstate(), or
they will access freed data when they fire.
This patch is separate from the patches that actually fix the issue
(HEAD^^ and HEAD^) so that you can run the associated regression iotest
(281) on a configuration that reproducibly exposes the bug.
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/nbd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/nbd.c b/block/nbd.c
index 5ff8a57314..dc6c3f3bbc 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -110,6 +110,10 @@ static void nbd_clear_bdrvstate(BlockDriverState *bs)
yank_unregister_instance(BLOCKDEV_YANK_INSTANCE(bs->node_name));
+ /* Must not leave timers behind that would access freed data */
+ assert(!s->reconnect_delay_timer);
+ assert(!s->open_timer);
+
object_unref(OBJECT(s->tlscreds));
qapi_free_SocketAddress(s->saddr);
s->saddr = NULL;
--
2.31.1
- [PULL v2 0/7] nbd: handle AioContext change correctly, Vladimir Sementsov-Ogievskiy, 2022/02/11
- [PULL v2 2/7] block/nbd: Delete open timer when done, Vladimir Sementsov-Ogievskiy, 2022/02/11
- [PULL v2 1/7] block/nbd: Delete reconnect delay timer when done, Vladimir Sementsov-Ogievskiy, 2022/02/11
- [PULL v2 6/7] block/nbd: Move s->ioc on AioContext change, Vladimir Sementsov-Ogievskiy, 2022/02/11
- [PULL v2 3/7] block/nbd: Assert there are no timers when closed,
Vladimir Sementsov-Ogievskiy <=
- [PULL v2 7/7] iotests/281: Let NBD connection yield in iothread, Vladimir Sementsov-Ogievskiy, 2022/02/11
- [PULL v2 5/7] iotests/281: Test lingering timers, Vladimir Sementsov-Ogievskiy, 2022/02/11
- [PULL v2 4/7] iotests.py: Add QemuStorageDaemon class, Vladimir Sementsov-Ogievskiy, 2022/02/11
- Re: [PULL v2 0/7] nbd: handle AioContext change correctly, Peter Maydell, 2022/02/13