public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [SCSI] qla4xxx: don't free pool that wasn't allocated
@ 2012-05-17  7:11 Dan Carpenter
  2012-05-17  7:13 ` [patch] [SCSI] qla2xxx: " Dan Carpenter
  2012-05-17 15:55 ` [patch] [SCSI] qla4xxx: " Mike Christie
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-05-17  7:11 UTC (permalink / raw)
  To: Ravi Anand
  Cc: Vikas Chaudhary, iscsi-driver, James E.J. Bottomley, linux-scsi,
	linux-kernel, kernel-janitors

In the original code if dma_pool_alloc() fails then we call
dma_pool_free().  The problem is that "chap_table" is NULL and
"chap_dma" is uninitialized so it will cause an error.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 7ac21da..21dce92 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1329,10 +1329,8 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username, char *password,
 	dma_addr_t chap_dma;
 
 	chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
-	if (chap_table = NULL) {
-		ret = -ENOMEM;
-		goto exit_get_chap;
-	}
+	if (chap_table = NULL)
+		return -ENOMEM;
 
 	chap_size = sizeof(struct ql4_chap_table);
 	memset(chap_table, 0, chap_size);

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

end of thread, other threads:[~2012-05-17 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17  7:11 [patch] [SCSI] qla4xxx: don't free pool that wasn't allocated Dan Carpenter
2012-05-17  7:13 ` [patch] [SCSI] qla2xxx: " Dan Carpenter
2012-05-17 17:04   ` Chad Dupuis
2012-05-17 15:55 ` [patch] [SCSI] qla4xxx: " Mike Christie

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