aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/loopback/tcm_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/loopback/tcm_loop.c')
-rw-r--r--drivers/target/loopback/tcm_loop.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index ee959032788e..9062b9ce9b6a 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -385,7 +385,7 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)
385 */ 385 */
386 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, (void *)tl_tmr, 386 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, (void *)tl_tmr,
387 TMR_LUN_RESET); 387 TMR_LUN_RESET);
388 if (!se_cmd->se_tmr_req) 388 if (IS_ERR(se_cmd->se_tmr_req))
389 goto release; 389 goto release;
390 /* 390 /*
391 * Locate the underlying TCM struct se_lun from sc->device->lun 391 * Locate the underlying TCM struct se_lun from sc->device->lun
@@ -1016,6 +1016,7 @@ static int tcm_loop_make_nexus(
1016 struct se_portal_group *se_tpg; 1016 struct se_portal_group *se_tpg;
1017 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 1017 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
1018 struct tcm_loop_nexus *tl_nexus; 1018 struct tcm_loop_nexus *tl_nexus;
1019 int ret = -ENOMEM;
1019 1020
1020 if (tl_tpg->tl_hba->tl_nexus) { 1021 if (tl_tpg->tl_hba->tl_nexus) {
1021 printk(KERN_INFO "tl_tpg->tl_hba->tl_nexus already exists\n"); 1022 printk(KERN_INFO "tl_tpg->tl_hba->tl_nexus already exists\n");
@@ -1032,8 +1033,10 @@ static int tcm_loop_make_nexus(
1032 * Initialize the struct se_session pointer 1033 * Initialize the struct se_session pointer
1033 */ 1034 */
1034 tl_nexus->se_sess = transport_init_session(); 1035 tl_nexus->se_sess = transport_init_session();
1035 if (!tl_nexus->se_sess) 1036 if (IS_ERR(tl_nexus->se_sess)) {
1037 ret = PTR_ERR(tl_nexus->se_sess);
1036 goto out; 1038 goto out;
1039 }
1037 /* 1040 /*
1038 * Since we are running in 'demo mode' this call with generate a 1041 * Since we are running in 'demo mode' this call with generate a
1039 * struct se_node_acl for the tcm_loop struct se_portal_group with the SCSI 1042 * struct se_node_acl for the tcm_loop struct se_portal_group with the SCSI
@@ -1059,7 +1062,7 @@ static int tcm_loop_make_nexus(
1059 1062
1060out: 1063out:
1061 kfree(tl_nexus); 1064 kfree(tl_nexus);
1062 return -ENOMEM; 1065 return ret;
1063} 1066}
1064 1067
1065static int tcm_loop_drop_nexus( 1068static int tcm_loop_drop_nexus(
@@ -1139,7 +1142,7 @@ static ssize_t tcm_loop_tpg_store_nexus(
1139 * the fabric protocol_id set in tcm_loop_make_scsi_hba(), and call 1142 * the fabric protocol_id set in tcm_loop_make_scsi_hba(), and call
1140 * tcm_loop_make_nexus() 1143 * tcm_loop_make_nexus()
1141 */ 1144 */
1142 if (strlen(page) > TL_WWN_ADDR_LEN) { 1145 if (strlen(page) >= TL_WWN_ADDR_LEN) {
1143 printk(KERN_ERR "Emulated NAA Sas Address: %s, exceeds" 1146 printk(KERN_ERR "Emulated NAA Sas Address: %s, exceeds"
1144 " max: %d\n", page, TL_WWN_ADDR_LEN); 1147 " max: %d\n", page, TL_WWN_ADDR_LEN);
1145 return -EINVAL; 1148 return -EINVAL;
@@ -1320,7 +1323,7 @@ struct se_wwn *tcm_loop_make_scsi_hba(
1320 return ERR_PTR(-EINVAL); 1323 return ERR_PTR(-EINVAL);
1321 1324
1322check_len: 1325check_len:
1323 if (strlen(name) > TL_WWN_ADDR_LEN) { 1326 if (strlen(name) >= TL_WWN_ADDR_LEN) {
1324 printk(KERN_ERR "Emulated NAA %s Address: %s, exceeds" 1327 printk(KERN_ERR "Emulated NAA %s Address: %s, exceeds"
1325 " max: %d\n", name, tcm_loop_dump_proto_id(tl_hba), 1328 " max: %d\n", name, tcm_loop_dump_proto_id(tl_hba),
1326 TL_WWN_ADDR_LEN); 1329 TL_WWN_ADDR_LEN);