Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-29 Thread David Hildenbrand
On 29.06.22 10:31, Tong Zhang wrote: > > > On Wed, Jun 29, 2022 at 12:29 AM David Hildenbrand > wrote: > > On 06.05.22 18:31, Tong Zhang wrote: > > assert(dbs->acb) is meant to check the return value of io_func per > > documented in commit 6bee44ea34 ("dma:

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-29 Thread Tong Zhang
On Wed, Jun 29, 2022 at 12:29 AM David Hildenbrand wrote: > On 06.05.22 18:31, Tong Zhang wrote: > > assert(dbs->acb) is meant to check the return value of io_func per > > documented in commit 6bee44ea34 ("dma: the passed io_func does not > > return NULL"). However, there is a chance that after c

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-29 Thread David Hildenbrand
On 06.05.22 18:31, Tong Zhang wrote: > assert(dbs->acb) is meant to check the return value of io_func per > documented in commit 6bee44ea34 ("dma: the passed io_func does not > return NULL"). However, there is a chance that after calling > aio_context_release(dbs->ctx); the dma_blk_cb function is c

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-28 Thread Laurent Vivier
Le 06/05/2022 à 18:31, Tong Zhang a écrit : assert(dbs->acb) is meant to check the return value of io_func per documented in commit 6bee44ea34 ("dma: the passed io_func does not return NULL"). However, there is a chance that after calling aio_context_release(dbs->ctx); the dma_blk_cb function is

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-01 Thread Stefan Hajnoczi
On Thu, Jun 2, 2022, 02:04 Tong Zhang wrote: > > Hi Stefan, > > On Wed, Jun 1, 2022 at 6:56 AM Stefan Hajnoczi wrote: > > > > > > This patch makes sense to me. Can you rephrase your concern? > > > > > > The locking is around dbs->io_func(). > > > > > > aio_context_acquire(dbs->ctx); > > > dbs->ac

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-01 Thread Tong Zhang
Hi Stefan, On Wed, Jun 1, 2022 at 6:56 AM Stefan Hajnoczi wrote: > > > > This patch makes sense to me. Can you rephrase your concern? > > > > The locking is around dbs->io_func(). > > > > aio_context_acquire(dbs->ctx); > > dbs->acb = dbs->io_func() > > aio_context_release(dbs->ctx); > > > > > > S

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-01 Thread Stefan Hajnoczi
On Wed, 1 Jun 2022 at 14:29, David Hildenbrand wrote: > > On 01.06.22 15:24, Stefan Hajnoczi wrote: > > On Wed, Jun 01, 2022 at 10:00:50AM +0200, David Hildenbrand wrote: > >> On 01.06.22 02:20, Tong Zhang wrote: > >>> Hi David, > >>> > >>> On Mon, May 30, 2022 at 9:19 AM David Hildenbrand > >>>

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-01 Thread David Hildenbrand
On 01.06.22 15:24, Stefan Hajnoczi wrote: > On Wed, Jun 01, 2022 at 10:00:50AM +0200, David Hildenbrand wrote: >> On 01.06.22 02:20, Tong Zhang wrote: >>> Hi David, >>> >>> On Mon, May 30, 2022 at 9:19 AM David Hildenbrand wrote: On 27.04.22 22:51, Tong Zhang wrote: > assert(dbs->acb

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-01 Thread Stefan Hajnoczi
On Wed, Jun 01, 2022 at 10:00:50AM +0200, David Hildenbrand wrote: > On 01.06.22 02:20, Tong Zhang wrote: > > Hi David, > > > > On Mon, May 30, 2022 at 9:19 AM David Hildenbrand wrote: > >> > >> On 27.04.22 22:51, Tong Zhang wrote: > >>> assert(dbs->acb) is meant to check the return value of io_f

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-06-01 Thread David Hildenbrand
On 01.06.22 02:20, Tong Zhang wrote: > Hi David, > > On Mon, May 30, 2022 at 9:19 AM David Hildenbrand wrote: >> >> On 27.04.22 22:51, Tong Zhang wrote: >>> assert(dbs->acb) is meant to check the return value of io_func per >>> documented in commit 6bee44ea34 ("dma: the passed io_func does not >>

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-05-31 Thread Tong Zhang
Hi David, On Mon, May 30, 2022 at 9:19 AM David Hildenbrand wrote: > > On 27.04.22 22:51, Tong Zhang wrote: > > assert(dbs->acb) is meant to check the return value of io_func per > > documented in commit 6bee44ea34 ("dma: the passed io_func does not > > return NULL"). However, there is a chance t

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-05-30 Thread David Hildenbrand
On 27.04.22 22:51, Tong Zhang wrote: > assert(dbs->acb) is meant to check the return value of io_func per > documented in commit 6bee44ea34 ("dma: the passed io_func does not > return NULL"). However, there is a chance that after calling > aio_context_release(dbs->ctx); the dma_blk_cb function is c

Re: [RESEND PATCH] hw/dma: fix crash caused by race condition

2022-05-30 Thread Philippe Mathieu-Daudé via
+Emanuele / Alexander / Stefan On 27/4/22 22:51, Tong Zhang wrote: assert(dbs->acb) is meant to check the return value of io_func per documented in commit 6bee44ea34 ("dma: the passed io_func does not return NULL"). However, there is a chance that after calling aio_context_release(dbs->ctx); the

[RESEND PATCH] hw/dma: fix crash caused by race condition

2022-05-06 Thread Tong Zhang
assert(dbs->acb) is meant to check the return value of io_func per documented in commit 6bee44ea34 ("dma: the passed io_func does not return NULL"). However, there is a chance that after calling aio_context_release(dbs->ctx); the dma_blk_cb function is called before the assertion and dbs->acb is se

[RESEND PATCH] hw/dma: fix crash caused by race condition

2022-04-27 Thread Tong Zhang
assert(dbs->acb) is meant to check the return value of io_func per documented in commit 6bee44ea34 ("dma: the passed io_func does not return NULL"). However, there is a chance that after calling aio_context_release(dbs->ctx); the dma_blk_cb function is called before the assertion and dbs->acb is se

[PATCH] hw/dma: fix crash caused by race condition

2022-04-08 Thread Tong Zhang
assert(dbs->acb) is meant to check the return value of io_func per documented in commit 6bee44ea34 ("dma: the passed io_func does not return NULL"). However, there is a chance that after calling aio_context_release(dbs->ctx); the dma_blk_cb function is called before the assertion and dbs->acb is se