[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/7] block/nbd: avoid touching freed connect_thread
From: |
Roman Kagan |
Subject: |
Re: [PATCH 1/7] block/nbd: avoid touching freed connect_thread |
Date: |
Tue, 16 Mar 2021 18:29:18 +0300 |
On Mon, Mar 15, 2021 at 06:40:12PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> 15.03.2021 09:06, Roman Kagan wrote:
> > When the NBD connection is being torn down, the connection thread gets
> > canceled and "detached", meaning it is about to get freed.
> >
> > If this happens while the connection coroutine yielded waiting for the
> > connection thread to complete, when it resumes it may access the
> > invalidated connection thread data.
> >
> > To prevent this, revalidate the ->connect_thread pointer in
> > nbd_co_establish_connection_cancel before using after the the yield.
> >
> > Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
>
> Seems possible. Do you have a reproducer? Would be great to make an iotest.
It triggered on me in iotest 277, but seems to be timing-dependent.
I'll see if I can do it reliable.
Thanks,
Roman.
- Re: [PATCH 6/7] block/nbd: decouple reconnect from drain, (continued)
[PATCH 5/7] block/nbd: better document a case in nbd_co_establish_connection, Roman Kagan, 2021/03/15
[PATCH 3/7] block/nbd: assert attach/detach runs in the proper context, Roman Kagan, 2021/03/15
[PATCH 4/7] block/nbd: transfer reconnection stuff across aio_context switch, Roman Kagan, 2021/03/15
[PATCH 1/7] block/nbd: avoid touching freed connect_thread, Roman Kagan, 2021/03/15
[PATCH 7/7] block/nbd: stop manipulating in_flight counter, Roman Kagan, 2021/03/15
[PATCH 2/7] block/nbd: use uniformly nbd_client_connecting_wait, Roman Kagan, 2021/03/15
Re: [PATCH 0/7] block/nbd: decouple reconnect from drain, Vladimir Sementsov-Ogievskiy, 2021/03/15
Re: [PATCH 0/7] block/nbd: decouple reconnect from drain, Eric Blake, 2021/03/16