From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ravi Anand <ravi.anand@qlogic.com>
Cc: Vikas Chaudhary <vikas.chaudhary@qlogic.com>,
iscsi-driver@qlogic.com,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] [SCSI] qla4xxx: don't free pool that wasn't allocated
Date: Thu, 17 May 2012 07:11:20 +0000 [thread overview]
Message-ID: <20120517071120.GG14660@elgon.mountain> (raw)
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);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ravi Anand <ravi.anand@qlogic.com>
Cc: Vikas Chaudhary <vikas.chaudhary@qlogic.com>,
iscsi-driver@qlogic.com,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] [SCSI] qla4xxx: don't free pool that wasn't allocated
Date: Thu, 17 May 2012 10:11:20 +0300 [thread overview]
Message-ID: <20120517071120.GG14660@elgon.mountain> (raw)
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);
next reply other threads:[~2012-05-17 7:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-17 7:11 Dan Carpenter [this message]
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 7:13 ` Dan Carpenter
2012-05-17 17:04 ` Chad Dupuis
2012-05-17 17:04 ` Chad Dupuis
2012-05-17 15:55 ` [patch] [SCSI] qla4xxx: " Mike Christie
2012-05-17 15:55 ` Mike Christie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120517071120.GG14660@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=JBottomley@parallels.com \
--cc=iscsi-driver@qlogic.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ravi.anand@qlogic.com \
--cc=vikas.chaudhary@qlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.