diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index eca92eb475a..0b2b0da5b88 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c @@ -755,6 +755,12 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud #endif } + /* Prevent unloading of the 1394 host */ + if (!try_module_get(hi->host->driver->owner)) { + SBP2_ERR("failed to get a reference on 1394 host driver"); + goto failed_alloc; + } + scsi_id->hi = hi; list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); @@ -1015,6 +1021,9 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id) scsi_id->ud->device.driver_data = NULL; + if (hi) + module_put(hi->host->driver->owner); + SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); kfree(scsi_id); |