From: Andy Shevchenko Date: Thu, 14 Feb 2013 09:00:15 +0000 (+0200) Subject: dma: of-dma: protect list write operation by spin_lock X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=88b386c0a7c278581d2b8e2c2761d12f6475938d;p=linux-beck.git dma: of-dma: protect list write operation by spin_lock It's possible to have an inconsistency in the list due to unprotected operation on it. The patch adds a proper locking on the list operation. Signed-off-by: Andy Shevchenko Acked-by: Rob Herring Acked-by: Viresh Kumar Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c index 583e50e3d47c..69d04d28b1ef 100644 --- a/drivers/dma/of-dma.c +++ b/drivers/dma/of-dma.c @@ -118,7 +118,9 @@ int of_dma_controller_register(struct device_node *np, ofdma->use_count = 0; /* Now queue of_dma controller structure in list */ + spin_lock(&of_dma_lock); list_add_tail(&ofdma->of_dma_controllers, &of_dma_list); + spin_unlock(&of_dma_lock); return 0; }