Patchwork [RFC] dmaengine: bcm2835: Avoid GFP_KERNEL in device_prep_slave_sg

login
register
mail settings
Submitter Stefan Wahren
Date April 1, 2019, 6:38 p.m.
Message ID <1554143899-4124-1-git-send-email-stefan.wahren@i2se.com>
Download mbox | patch
Permalink /patch/762799/
State New
Headers show

Comments

Stefan Wahren - April 1, 2019, 6:38 p.m.
The commit af19b7ce76ba ("mmc: bcm2835: Avoid possible races on
data requests") introduces a possible circular locking dependency,
which is triggered by swapping to the sdhost interface.

So instead of reintroduce the race condition again, we could also
avoid this situation by using GFP_NOWAIT for the allocation of the
DMA buffer descriptors.

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: af19b7ce76ba ("mmc: bcm2835: Avoid possible races on data requests")
Link: http://lists.infradead.org/pipermail/linux-rpi-kernel/2019-March/008615.html
---
 drivers/dma/bcm2835-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Vinod Koul - April 23, 2019, 5:11 a.m.
On 01-04-19, 20:38, Stefan Wahren wrote:
> The commit af19b7ce76ba ("mmc: bcm2835: Avoid possible races on
> data requests") introduces a possible circular locking dependency,
> which is triggered by swapping to the sdhost interface.
> 
> So instead of reintroduce the race condition again, we could also
> avoid this situation by using GFP_NOWAIT for the allocation of the
> DMA buffer descriptors.

Applied, thanks

Patch

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index ec8a291..54093ff 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -671,7 +671,7 @@  static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
 	d = bcm2835_dma_create_cb_chain(chan, direction, false,
 					info, extra,
 					frames, src, dst, 0, 0,
-					GFP_KERNEL);
+					GFP_NOWAIT);
 	if (!d)
 		return NULL;