Skip to content

Commit

Permalink
dmaengine: protect 'id' from concurrent registrations
Browse files Browse the repository at this point in the history
There is a possibility to have two devices registered with the same id.

Cc: <[email protected]>
Acked-by: Maciej Sosnowski <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
djbw committed Dec 4, 2008
1 parent 532d3b1 commit b0b42b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/dma/dmaengine.c
Original file line number Diff line number Diff line change
@@ -388,7 +388,10 @@ int dma_async_device_register(struct dma_device *device)

init_completion(&device->done);
kref_init(&device->refcount);

mutex_lock(&dma_list_mutex);
device->dev_id = id++;
mutex_unlock(&dma_list_mutex);

/* represent channels in sysfs. Probably want devs too */
list_for_each_entry(chan, &device->channels, device_node) {

0 comments on commit b0b42b1

Please sign in to comment.