diff options
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 7c76a989b218..7e6e031cc41b 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1287,13 +1287,18 @@ iscsi_session_setup(struct iscsi_transport *iscsit, | |||
1287 | if (scsi_add_host(shost, NULL)) | 1287 | if (scsi_add_host(shost, NULL)) |
1288 | goto add_host_fail; | 1288 | goto add_host_fail; |
1289 | 1289 | ||
1290 | if (!try_module_get(iscsit->owner)) | ||
1291 | goto cls_session_fail; | ||
1292 | |||
1290 | cls_session = iscsi_create_session(shost, iscsit, 0); | 1293 | cls_session = iscsi_create_session(shost, iscsit, 0); |
1291 | if (!cls_session) | 1294 | if (!cls_session) |
1292 | goto cls_session_fail; | 1295 | goto module_put; |
1293 | *(unsigned long*)shost->hostdata = (unsigned long)cls_session; | 1296 | *(unsigned long*)shost->hostdata = (unsigned long)cls_session; |
1294 | 1297 | ||
1295 | return cls_session; | 1298 | return cls_session; |
1296 | 1299 | ||
1300 | module_put: | ||
1301 | module_put(iscsit->owner); | ||
1297 | cls_session_fail: | 1302 | cls_session_fail: |
1298 | scsi_remove_host(shost); | 1303 | scsi_remove_host(shost); |
1299 | add_host_fail: | 1304 | add_host_fail: |
@@ -1325,6 +1330,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | |||
1325 | 1330 | ||
1326 | iscsi_destroy_session(cls_session); | 1331 | iscsi_destroy_session(cls_session); |
1327 | scsi_host_put(shost); | 1332 | scsi_host_put(shost); |
1333 | module_put(cls_session->transport->owner); | ||
1328 | } | 1334 | } |
1329 | EXPORT_SYMBOL_GPL(iscsi_session_teardown); | 1335 | EXPORT_SYMBOL_GPL(iscsi_session_teardown); |
1330 | 1336 | ||