summaryrefslogtreecommitdiff
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-12-14 19:19:23 +0100
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-03-24 20:56:38 +0100
commit97811e347310766030a648fdf0e407b2c91a39c1 (patch)
tree61710722bac7ffd91915e09f42e0412727bba53b /drivers/firewire
parent1f3125af8ed7410cc0ebcc0acd59bbfc1ae0057a (diff)
firewire: cdev: fix race of fw_device_op_release with bus reset
Unlink the client from the fw_device earlier in order to prevent bus reset events being added to client->event_list during shutdown. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-cdev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index a320ab48edd6..4dd66c1a36da 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -1009,6 +1009,10 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
struct event *e, *next_e;
struct client_resource *r, *next_r;
+ mutex_lock(&client->device->client_list_mutex);
+ list_del(&client->link);
+ mutex_unlock(&client->device->client_list_mutex);
+
if (client->buffer.pages)
fw_iso_buffer_destroy(&client->buffer, client->device->card);
@@ -1026,10 +1030,6 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
list_for_each_entry_safe(e, next_e, &client->event_list, link)
kfree(e);
- mutex_lock(&client->device->client_list_mutex);
- list_del(&client->link);
- mutex_unlock(&client->device->client_list_mutex);
-
fw_device_put(client->device);
kfree(client);