[PATCH 4/5] firewire: fw-sbp2: fix reference counting

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux1394-devel@...>
Cc: Kristian Hoegsberg <krh@...>, Jarod Wilson <jwilson@...>, <linux-kernel@...>
Date: Sunday, February 24, 2008 - 2:00 pm

The reference count of the unit dropped too low in an error path in
sbp2_probe.  Fixed by moving the _get further up.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -1083,6 +1083,7 @@ static int sbp2_probe(struct device *dev
 		goto fail_shost_put;
 
 	fw_device_get(device);
+	get_device(&unit->device);
 
 	/* Initialize to values that won't match anything in our table. */
 	firmware_revision = 0xff000000;
@@ -1098,8 +1099,6 @@ static int sbp2_probe(struct device *dev
 
 	sbp2_init_workarounds(tgt, model, firmware_revision);
 
-	get_device(&unit->device);
-
 	/* Do the login in a workqueue so we can easily reschedule retries. */
 	list_for_each_entry(lu, &tgt->lu_list, link)
 		sbp2_queue_work(lu, 0);

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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/5] firewire: fix crashes in workqueue jobs, Stefan Richter, (Sun Feb 24, 1:56 pm)
[PATCH 5/5] firewire: refactor fw_unit reference counting, Stefan Richter, (Sun Feb 24, 2:01 pm)
[PATCH 4/5] firewire: fw-sbp2: fix reference counting, Stefan Richter, (Sun Feb 24, 2:00 pm)
Re: [PATCH 2/5] firewire: fix crash in automatic module unlo..., Kristian Høgsberg, (Mon Mar 3, 12:45 pm)
Re: [PATCH 2/5] firewire: fix crash in automatic module unlo..., Kristian Høgsberg, (Mon Mar 3, 1:37 pm)