]> git.ipfire.org Git - thirdparty/qemu.git/commit
block/nbd: ensure ->connection_thread is always valid
authorRoman Kagan <rvkagan@yandex-team.ru>
Thu, 10 Jun 2021 10:07:37 +0000 (13:07 +0300)
committerEric Blake <eblake@redhat.com>
Fri, 18 Jun 2021 15:59:53 +0000 (10:59 -0500)
commite8b35bf5dc8d4e98d91855a9c7b2ed905c8e6888
treebb992ae52e0197a78d052b42524119a6bc59c247
parent6cc702beac795a6de7b5f97700b140dcd9936055
block/nbd: ensure ->connection_thread is always valid

Simplify lifetime management of BDRVNBDState->connect_thread by
delaying the possible cleanup of it until the BDRVNBDState itself goes
away.

This also reverts
 0267101af6 "block/nbd: fix possible use after free of s->connect_thread"
as now s->connect_thread can't be cleared until the very end.

Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
 [vsementsov: rebase, revert 0267101af6 changes]
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
 [eblake: tweak comment]
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210610100802.5888-8-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
block/nbd.c