public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] Dereference in drivers/scsi/lpfc/lpfc_ct.c
@ 2006-10-01 20:31 Eric Sesterhenn
  2006-10-02 15:37 ` James Smart
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sesterhenn @ 2006-10-01 20:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: james.smart

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.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.18-git16/drivers/scsi/lpfc/lpfc_ct.c.orig	2006-10-01 22:28:37.000000000 +0200
+++ linux-2.6.18-git16/drivers/scsi/lpfc/lpfc_ct.c	2006-10-01 22:29:10.000000000 +0200
@@ -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;
 		}
 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch] Dereference in drivers/scsi/lpfc/lpfc_ct.c
  2006-10-01 20:31 [Patch] Dereference in drivers/scsi/lpfc/lpfc_ct.c Eric Sesterhenn
@ 2006-10-02 15:37 ` James Smart
  0 siblings, 0 replies; 2+ messages in thread
From: James Smart @ 2006-10-02 15:37 UTC (permalink / raw)
  To: Eric Sesterhenn; +Cc: linux-kernel

ACK - good fix.

-- james s

Eric Sesterhenn wrote:
> 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.
> 
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
> 
> --- linux-2.6.18-git16/drivers/scsi/lpfc/lpfc_ct.c.orig	2006-10-01 22:28:37.000000000 +0200
> +++ linux-2.6.18-git16/drivers/scsi/lpfc/lpfc_ct.c	2006-10-01 22:29:10.000000000 +0200
> @@ -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;
>  		}
>  
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-02 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-01 20:31 [Patch] Dereference in drivers/scsi/lpfc/lpfc_ct.c Eric Sesterhenn
2006-10-02 15:37 ` James Smart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox