Skip to content

Commit

Permalink
ieee1394: sbp2: fix sbp2_remove_device for error cases
Browse files Browse the repository at this point in the history
Bug found by Olaf Hering <[email protected]>:
sbp2util_remove_command_orb_pool requires a valid lu->hi pointer.

Signed-off-by: Stefan Richter <[email protected]>
  • Loading branch information
Stefan Richter committed Aug 25, 2007
1 parent d1caeb0 commit a2ee3f9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/ieee1394/sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,9 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu)
return 0;
}

static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu)
static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu,
struct hpsb_host *host)
{
struct hpsb_host *host = lu->hi->host;
struct list_head *lh, *next;
struct sbp2_command_info *cmd;
unsigned long flags;
Expand Down Expand Up @@ -922,15 +922,16 @@ static void sbp2_remove_device(struct sbp2_lu *lu)

if (!lu)
return;

hi = lu->hi;
if (!hi)
goto no_hi;

if (lu->shost) {
scsi_remove_host(lu->shost);
scsi_host_put(lu->shost);
}
flush_scheduled_work();
sbp2util_remove_command_orb_pool(lu);
sbp2util_remove_command_orb_pool(lu, hi->host);

list_del(&lu->lu_list);

Expand Down Expand Up @@ -971,9 +972,8 @@ static void sbp2_remove_device(struct sbp2_lu *lu)

lu->ud->device.driver_data = NULL;

if (hi)
module_put(hi->host->driver->owner);

module_put(hi->host->driver->owner);
no_hi:
kfree(lu);
}

Expand Down

0 comments on commit a2ee3f9

Please sign in to comment.