[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9378e69f-2bd4-9d8d-c736-b8799f6ebecc@deltatee.com>
Date: Wed, 26 Jul 2023 09:57:16 -0600
From: Logan Gunthorpe <logang@...tatee.com>
To: Chengfeng Ye <dg573847474@...il.com>, vkoul@...nel.org
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: plx_dma: Fix potential deadlock on
&plxdev->ring_lock
On 2023-07-26 04:48, Chengfeng Ye wrote:
> As plx_dma_process_desc() is invoked by both tasklet plx_dma_desc_task()
> under softirq context and plx_dma_tx_status() callback that executed under
> process context, the lock aquicision of &plxdev->ring_lock inside
> plx_dma_process_desc() should disable irq otherwise deadlock could happen
> if the irq preempts the execution of process context code while the lock
> is held in process context on the same CPU.
>
> Possible deadlock scenario:
> plx_dma_tx_status()
> -> plx_dma_process_desc()
> -> spin_lock(&plxdev->ring_lock)
> <tasklet softirq>
> -> plx_dma_desc_task()
> -> plx_dma_process_desc()
> -> spin_lock(&plxdev->ring_lock) (deadlock here)
>
> This flaw was found by an experimental static analysis tool I am developing
> for irq-related deadlock.
>
> The tentative patch fixes the potential deadlock by spin_lock_irqsave() in
> plx_dma_process_desc() to disable irq while lock is held.
>
> Signed-off-by: Chengfeng Ye <dg573847474@...il.com>
Makes sense. Thanks!
Reviewed-by: Logan Gunthorpe <logang@...tatee.com>
Logan
Powered by blists - more mailing lists