From: Dan Williams Date: Thu, 4 Dec 2008 00:17:07 +0000 (-0700) Subject: dmaengine: protect 'id' from concurrent registrations X-Git-Tag: v2.6.28-rc9~1^2~1 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=b0b42b16ff2b90f17bc1a4308366c9beba4b276e;p=linux-2.6-omap-h63xx.git dmaengine: protect 'id' from concurrent registrations There is a possibility to have two devices registered with the same id. Cc: Acked-by: Maciej Sosnowski Signed-off-by: Dan Williams --- diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 5317e08221e..65799651737 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) {