Skip to contentSkip to conversation

Dereference in drivers/scsi/lpfc/lpfc_ct.c

PATCH In review Eric Sesterhenn 2 participants 2 messages Oct 1, 2006 – Oct 2, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Dereference in drivers/scsi/lpfc/lpfc_ct.c

hi,

if we fail to allocate mp->virt during the first while loop iteration, mlist is still uninitialized, therefore we should check if before dereferencing.

drivers/scsi/lpfc/lpfc_ct.c renamed from drivers/scsi/lpfc/lpfc_ct.c.orig +2 -1
@@ -188,7 +188,8 @@ lpfc_alloc_ct_rsp(struct lpfc_hba * phba
 
 		if (!mp->virt) {
 			kfree(mp);
-			lpfc_free_ct_rsp(phba, mlist);
+			if (mlist)
+				lpfc_free_ct_rsp(phba, mlist);
 			return NULL;
 		}
 
#1 lore raw

ACK - good fix.

-- james s

Quoted 23 lines · Eric Sesterhenn

hi,

if we fail to allocate mp->virt during the first while loop iteration, mlist is still uninitialized, therefore we should check if before dereferencing.

drivers/scsi/lpfc/lpfc_ct.c renamed from drivers/scsi/lpfc/lpfc_ct.c.orig +2 -1
@@ -188,7 +188,8 @@ lpfc_alloc_ct_rsp(struct lpfc_hba * phba
 
 		if (!mp->virt) {
 			kfree(mp);
-			lpfc_free_ct_rsp(phba, mlist);
+			if (mlist)
+				lpfc_free_ct_rsp(phba, mlist);
 			return NULL;
 		}