Skip to content

Commit

Permalink
firewire: cdev: fix race of fw_device_op_release with bus reset
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Richter committed Mar 24, 2009
1 parent 1f3125a commit 97811e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/firewire/fw-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 97811e3

Please sign in to comment.