Commit 50eb930a authored by Andrew Vasquez's avatar Andrew Vasquez Committed by Chris Wright

[PATCH] qla2xxx: Correct handling of fc_remote_port_add() failure case.

Correct handling of fc_remote_port_add() failure case.

Immediately return if fc_remote_port_add() fails to allocate
resources for the rport.  Original code would result in NULL
pointer dereference upon failure.
Reported-by: default avatarMichael Reed <mdr@sgi.com>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ab998a67
......@@ -1914,9 +1914,11 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET;
fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids);
if (!rport)
if (!rport) {
qla_printk(KERN_WARNING, ha,
"Unable to allocate fc remote port!\n");
return;
}
if (rport->scsi_target_id != -1 && rport->scsi_target_id < MAX_TARGETS)
fcport->os_target_id = rport->scsi_target_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment