[patch 08/21] dmaengine: protect id from concurrent registrations
From: Greg KH
Date: Mon Jan 12 2009 - 20:32:26 EST
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Williams <dan.j.williams@xxxxxxxxx>
commit b0b42b16ff2b90f17bc1a4308366c9beba4b276e upstream.
There is a possibility to have two devices registered with the same id.
Acked-by: Maciej Sosnowski <maciej.sosnowski@xxxxxxxxx>
Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
drivers/dma/dmaengine.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -388,7 +388,10 @@ int dma_async_device_register(struct dma
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) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/