diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-12-03 17:17:07 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-14 09:44:03 -0800 |
commit | ad4efe4fc5363e79bf6db87b012b73189806f4c7 (patch) | |
tree | 5c7e492fca9881c1aa8f3da0cb3386a93cb04ace | |
parent | cf7af4a82fe408a8c9628480ac3dc272e087ce75 (diff) |
dmaengine: protect 'id' from concurrent registrations
commit b0b42b16ff2b90f17bc1a4308366c9beba4b276e upstream.
There is a possibility to have two devices registered with the same id.
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-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 dc003a3a787..53bb74b2af6 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) { |