When target is not yet configured PRLI is ignored and consequent PLOGI comes in the wrong state and produces WARN: WARNING: CPU: 25 PID: 2429 at drivers/scsi/elx/libefc/efc_device.c:350 efc_send_ls_acc_after_attach+0x20/0x58 [efct] Reject PRLI like in other error cases when session can not be created. And fix a memory leak of wq_data in the same place. Signed-off-by: Dmitry Bogdanov <d.bogdanov@xxxxxxxxx> --- drivers/scsi/elx/efct/efct_lio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c index 9c45a0ca9191..dbe2f1871da3 100644 --- a/drivers/scsi/elx/efct/efct_lio.c +++ b/drivers/scsi/elx/efct/efct_lio.c @@ -1183,6 +1183,7 @@ static void efct_lio_setup_session(struct work_struct *work) struct se_session *se_sess; int watermark; int ini_count; + int ret = 0; u64 id; /* Check to see if it's belongs to vport, @@ -1196,7 +1197,8 @@ static void efct_lio_setup_session(struct work_struct *work) se_tpg = &tpg->tpg; } else { efc_log_err(efct, "failed to init session\n"); - return; + ret = -EIO; + goto done; } /* @@ -1210,9 +1212,8 @@ static void efct_lio_setup_session(struct work_struct *work) node, efct_session_cb); if (IS_ERR(se_sess)) { efc_log_err(efct, "failed to setup session\n"); - kfree(wq_data); - efc_scsi_sess_reg_complete(node, -EIO); - return; + ret = -EIO; + goto done; } tgt_node = node->tgt_node; @@ -1224,8 +1225,6 @@ static void efct_lio_setup_session(struct work_struct *work) if (xa_err(xa_store(&efct->lookup, id, tgt_node, GFP_KERNEL))) efc_log_err(efct, "Node lookup store failed\n"); - efc_scsi_sess_reg_complete(node, 0); - /* update IO watermark: increment initiator count */ ini_count = atomic_add_return(1, &efct->tgt_efct.initiator_count); watermark = efct->tgt_efct.watermark_max - @@ -1234,7 +1233,9 @@ static void efct_lio_setup_session(struct work_struct *work) efct->tgt_efct.watermark_min : watermark; atomic_set(&efct->tgt_efct.io_high_watermark, watermark); +done: kfree(wq_data); + efc_scsi_sess_reg_complete(node, ret); } int efct_scsi_new_initiator(struct efc *efc, struct efc_node *node) -- 2.25.1