Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0b42b16 authored by Dan Williams's avatar Dan Williams
Browse files

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: default avatarMaciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 532d3b1f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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) {