[SCSI] lpfc: check before dereference in lpfc_ct.c
authorEric Sesterhenn <snakebyte@gmx.de>
Tue, 10 Oct 2006 21:41:43 +0000 (14:41 -0700)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Wed, 25 Oct 2006 22:12:34 +0000 (15:12 -0700)
If we fail to allocate mp->virt during the first while loop iteration,
mlist is still uninitialized, therefore we should check if before
dereferencing.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/lpfc/lpfc_ct.c

index 1b53afb1cb5768c4946e889987cd58ab1691be39..3add7c237859d66347ff5ea69d19a3969d3da72e 100644 (file)
@@ -188,7 +188,8 @@ lpfc_alloc_ct_rsp(struct lpfc_hba * phba, int cmdcode, struct ulp_bde64 * bpl,
 
                if (!mp->virt) {
                        kfree(mp);
-                       lpfc_free_ct_rsp(phba, mlist);
+                       if (mlist)
+                               lpfc_free_ct_rsp(phba, mlist);
                        return NULL;
                }