diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-12-03 17:17:07 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-12-03 17:25:36 -0700 |
commit | b0b42b16ff2b90f17bc1a4308366c9beba4b276e (patch) | |
tree | d9025b46fe5360300ae4e430df3246c67602adad /drivers/dma | |
parent | 532d3b1f86f41834a25373e3ded981d68e4ce17f (diff) | |
download | blackbird-op-linux-b0b42b16ff2b90f17bc1a4308366c9beba4b276e.tar.gz blackbird-op-linux-b0b42b16ff2b90f17bc1a4308366c9beba4b276e.zip |
dmaengine: protect 'id' from concurrent registrations
There is a possibility to have two devices registered with the same id.
Cc: <stable@kernel.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dmaengine.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 5317e08221ec..657996517374 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -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) { |