public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, Jay Fenlason <fenlason@redhat.com>
Subject: [PATCH 1/4] firewire: cdev: fix race of fw_device_op_release with bus reset
Date: Sun, 14 Dec 2008 19:19:23 +0100 (CET)	[thread overview]
Message-ID: <tkrat.48fd4e3f4e528775@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.7bf80e1dd5c90f36@s5r6.in-berlin.de>

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>
---
 drivers/firewire/fw-cdev.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/drivers/firewire/fw-cdev.c
===================================================================
--- linux.orig/drivers/firewire/fw-cdev.c
+++ linux/drivers/firewire/fw-cdev.c
@@ -1009,6 +1009,10 @@ static int fw_device_op_release(struct i
 	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 i
 	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);
 


-- 
Stefan Richter
-=====-==--- ==-- -===-
http://arcgraph.de/sr/


  reply	other threads:[~2008-12-14 18:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081124163728.GA5826@redhat.com>
2008-11-24 19:09 ` idr: IDs guaranteed to be less than 1<<31? (was Re: [PATCH] firewire: us an idr rather than a linked list for resources) Stefan Richter
     [not found] ` <492AEED8.9030102@s5r6.in-berlin.de>
     [not found]   ` <492AEF9D.5010307@s5r6.in-berlin.de>
2008-12-14 18:17     ` [PATCH 0/4] firewire: cdev resources and events Stefan Richter
2008-12-14 18:19       ` Stefan Richter [this message]
2008-12-14 18:20       ` [PATCH 2/4] firewire: cdev: use an idr rather than a linked list for resources Stefan Richter
2008-12-18 22:43         ` Stefan Richter
2008-12-18 23:05           ` Stefan Richter
2008-12-21 15:47             ` [PATCH 2/4 update] " Stefan Richter
2008-12-14 18:21       ` [PATCH 3/4] firewire: cdev: address handler input validation Stefan Richter
2008-12-14 18:21       ` [PATCH 4/4] firewire: core: remove outdated comment Stefan Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tkrat.48fd4e3f4e528775@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=fenlason@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox