]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] qla2xxx: Correct handling of fc_remote_port_add() failure case.
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Thu, 14 Jul 2005 23:40:04 +0000 (16:40 -0700)
committerChris Wright <chrisw@osdl.org>
Fri, 5 Aug 2005 07:04:14 +0000 (00:04 -0700)
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: Michael Reed <mdr@sgi.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/qla2xxx/qla_init.c

index 0387005fcb6df08dc1f4b3c1c9d924eb7cfdfb1e..4d624881e2bc4a639f8c455b3e4c1da822548798 100644 (file)
@@ -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;