Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5b7da11 authored by Dick Kennedy's avatar Dick Kennedy Committed by Greg Kroah-Hartman
Browse files

scsi: lpfc: Fix oops if nvmet_fc_register_targetport fails



commit e7981a2c725f8e237f749fa1358997707d57e32c upstream.

if nvmet targetport registration fails, the driver encounters a NULL
pointer oops in lpfc_hb_timeout_handler.

To fix: if registration fails, ensure nvmet_support is cleared on the
port structure.

Also enhanced the log message on failure.

Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55d8b650
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -1138,9 +1138,14 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
#endif
	if (error) {
		lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC,
				"6025 Cannot register NVME targetport "
				"x%x\n", error);
				"6025 Cannot register NVME targetport x%x: "
				"portnm %llx nodenm %llx segs %d qs %d\n",
				error,
				pinfo.port_name, pinfo.node_name,
				lpfc_tgttemplate.max_sgl_segments,
				lpfc_tgttemplate.max_hw_queues);
		phba->targetport = NULL;
		phba->nvmet_support = 0;

		lpfc_nvmet_cleanup_io_context(phba);

@@ -1152,9 +1157,11 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
		lpfc_printf_log(phba, KERN_INFO, LOG_NVME_DISC,
				"6026 Registered NVME "
				"targetport: %p, private %p "
				"portnm %llx nodenm %llx\n",
				"portnm %llx nodenm %llx segs %d qs %d\n",
				phba->targetport, tgtp,
				pinfo.port_name, pinfo.node_name);
				pinfo.port_name, pinfo.node_name,
				lpfc_tgttemplate.max_sgl_segments,
				lpfc_tgttemplate.max_hw_queues);

		atomic_set(&tgtp->rcv_ls_req_in, 0);
		atomic_set(&tgtp->rcv_ls_req_out, 0);