Skip to content

Commit

Permalink
dma: of-dma: protect list write operation by spin_lock
Browse files Browse the repository at this point in the history
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 <andriy.shevchenko@linux.intel.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Andy Shevchenko authored and Vinod Koul committed Feb 14, 2013
1 parent 7dd1452 commit 88b386c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/dma/of-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 88b386c

Please sign in to comment.