lpfc 8.3.19: Fix critical errors and crashes
Subsystems (2)
PATCH 1/6 lpfc 8.3.19: Fix critical errors and crashes
Fix critical errors and crashes
- Replace LOF_SECURITY with LOG_SECURITY
- When calculating diag test memory size, use full size with header.
- Return LS_RJT with status=UNSUPPORTED on unrecognized ELS's
- Correct NULL pointer dereference when lpfc_create_vport_work_array() returns NULL.
- Added code to handle CVL when port is in LPFC_VPORT_FAILED state.
- In lpfc_do_scr_ns_plogi, check the nodelist for FDMI_DID and reuse the resource.
- Check for generic request 64 and calculate the sgl offset for the request and reply sgls, also calculate the xmit length using only the request bde.
Signed-off-by Alex Iannicelli <[email protected]>
Signed-off-by James Smart <[email protected]>
---
lpfc_bsg.c | 4 +-- lpfc_els.c | 31 ++++++++++++++++++++-------- lpfc_hbadisc.c | 9 ++++++++ lpfc_init.c | 6 +++-- lpfc_logmsg.h | 2 - lpfc_sli.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 14 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +2 -2
@@ -2162,7 +2162,7 @@ lpfc_bsg_diag_test(struct fc_bsg_job *jo goto loopback_test_exit; } -if (size >=BUF_SZ_4K ) { +if (full_size >=BUF_SZ_4K ) {/* * Allocate memory for ioctl data. If buffer is bigger than 64k, * then we allocate 64k and re-use that buffer over and over to
@@ -2171,7 +2171,7 @@ lpfc_bsg_diag_test(struct fc_bsg_job *jo* problem with GET_FCPTARGETMAPPING... */ if (size <= (64 *1024 )) - total_mem = size; + total_mem = full_size;else total_mem =64 *1024 ; }else
drivers/scsi/lpfc/lpfc_els.c +22 -9
@@ -6201,7 +6201,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *p cmd, did, vport->port_state);/* Unsupported ELS command, reject */ - rjt_err =LSRJT_INVALID_CMD ; + rjt_err =LSRJT_CMD_UNSUPPORTED ;/* Unknown ELS command <elsCmd> received from NPORT <did> */ lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
@@ -6408,18 +6408,31 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *ph }if (vport->cfg_fdmi_on) { - ndlp_fdmi =mempool_alloc (phba->nlp_mem_pool, -GFP_KERNEL ); +/* If this is the first time, allocate an ndlp and initialize +* it. Otherwise, make sure the node is enabled and then do the +* login. +*/ + ndlp_fdmi =lpfc_findnode_did (vport,FDMI_DID ); +if (!ndlp_fdmi) { + ndlp_fdmi =mempool_alloc (phba->nlp_mem_pool, +GFP_KERNEL ); +if (ndlp_fdmi) { +lpfc_nlp_init (vport, ndlp_fdmi,FDMI_DID ); + ndlp_fdmi->nlp_type |=NLP_FABRIC ; + }else +return ; + } +if (!NLP_CHK_NODE_ACT (ndlp_fdmi)) + ndlp_fdmi =lpfc_enable_node (vport, + ndlp_fdmi, +NLP_STE_NPR_NODE ); +if (ndlp_fdmi) { -lpfc_nlp_init (vport, ndlp_fdmi,FDMI_DID ); - ndlp_fdmi->nlp_type |=NLP_FABRIC ;lpfc_nlp_set_state (vport, ndlp_fdmi, -NLP_STE_PLOGI_ISSUE ); -lpfc_issue_els_plogi (vport, ndlp_fdmi->nlp_DID, -0 ); +NLP_STE_PLOGI_ISSUE ); +lpfc_issue_els_plogi (vport, ndlp_fdmi->nlp_DID,0 ); } } -return ; }/**
drivers/scsi/lpfc/lpfc_hbadisc.c +9 -0
@@ -4059,6 +4059,11 @@ lpfc_unreg_hba_rpis(struct lpfc_hba *phbint i; vports =lpfc_create_vport_work_array (phba); +if (!vports) { +lpfc_printf_log (phba,KERN_ERR ,LOG_DISCOVERY , +"2884 Vport array allocation failed \n" ); +return ; + }for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) { shost =lpfc_shost_from_vport (vports[i]);spin_lock_irq (shost->host_lock);
@@ -5254,6 +5259,10 @@ lpfc_fcf_inuse(struct lpfc_hba *phba) vports =lpfc_create_vport_work_array (phba); +/* If driver cannot allocate memory, indicate fcf is in use */ +if (!vports) +return 1 ; +for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) { shost =lpfc_shost_from_vport (vports[i]);spin_lock_irq (shost->host_lock);
drivers/scsi/lpfc/lpfc_init.c +4 -2
@@ -3247,10 +3247,12 @@ lpfc_sli4_perform_vport_cvl(struct lpfc_if (!ndlp)return 0 ; } -if (phba->pport->port_state <LPFC_FLOGI ) +if ((phba->pport->port_state <LPFC_FLOGI ) && + (phba->pport->port_state !=LPFC_VPORT_FAILED ))return NULL ;/* If virtual link is not yet instantiated ignore CVL */ -if ((vport != phba->pport) && (vport->port_state <LPFC_FDISC )) +if ((vport != phba->pport) && (vport->port_state <LPFC_FDISC ) + && (vport->port_state !=LPFC_VPORT_FAILED ))return NULL ; shost =lpfc_shost_from_vport (vport);if (!shost)
drivers/scsi/lpfc/lpfc_logmsg.h +1 -1
@@ -33,7 +33,7 @@#define LOG_FCP_ERROR 0x00001000/* log errors, not underruns */ #define LOG_LIBDFC 0x00002000/* Libdfc events */ #define LOG_VPORT 0x00004000/* NPIV events */ -#define LOF_SECURITY 0x00008000/* Security events */ +#define LOG_SECURITY 0x00008000/* Security events */ #define LOG_EVENT 0x00010000/* CT,TEMP,DUMP, logging */ #define LOG_FIP 0x00020000/* FIP events */ #define LOG_ALL_MSG 0xffffffff/* LOG all messages */
drivers/scsi/lpfc/lpfc_sli.c +61 -0
91 lines not on this page · raw message