if (scsi_add_host(shost, NULL))
goto add_host_fail;
+ if (!try_module_get(iscsit->owner))
+ goto cls_session_fail;
+
cls_session = iscsi_create_session(shost, iscsit, 0);
if (!cls_session)
- goto cls_session_fail;
+ goto module_put;
*(unsigned long*)shost->hostdata = (unsigned long)cls_session;
return cls_session;
+module_put:
+ module_put(iscsit->owner);
cls_session_fail:
scsi_remove_host(shost);
add_host_fail:
iscsi_destroy_session(cls_session);
scsi_host_put(shost);
+ module_put(cls_session->transport->owner);
}
EXPORT_SYMBOL_GPL(iscsi_session_teardown);
static void iscsi_session_release(struct device *dev)
{
struct iscsi_cls_session *session = iscsi_dev_to_session(dev);
- struct iscsi_transport *transport = session->transport;
struct Scsi_Host *shost;
shost = iscsi_session_to_shost(session);
scsi_host_put(shost);
kfree(session);
- module_put(transport->owner);
}
static int iscsi_is_session_dev(const struct device *dev)
struct iscsi_cls_session *session;
int err;
- if (!try_module_get(transport->owner))
- return NULL;
-
session = kzalloc(sizeof(*session) + transport->sessiondata_size,
GFP_KERNEL);
if (!session)
- goto module_put;
+ return NULL;
+
session->transport = transport;
session->recovery_tmo = 120;
INIT_WORK(&session->recovery_work, session_recovery_timedout, session);
free_session:
kfree(session);
-module_put:
- module_put(transport->owner);
return NULL;
}