stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	Michael Hernandez <michael.hernandez@cavium.com>,
	Himanshu Madhani <himanshu.madhani@cavium.com>,
	Christoph Hellwig <hch@lst.de>, <stable@vger.kernel.org>
Subject: [PATCH 1/2] qla2xxx: Fix a recently introduced memory leak
Date: Mon, 23 Jan 2017 08:34:45 -0800	[thread overview]
Message-ID: <20170123163446.9227-2-bart.vanassche@sandisk.com> (raw)
In-Reply-To: <20170123163446.9227-1-bart.vanassche@sandisk.com>

qla2x00_probe_one() allocates IRQs before it initializes rsp_q_map
so IRQs must be freed even if rsp_q_map allocation did not occur.
This was detected by kmemleak.

Fixes: 4fa183455988 ("scsi: qla2xxx: Utilize pci_alloc_irq_vectors/pci_free_irq_vectors calls")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Michael Hernandez <michael.hernandez@cavium.com>
Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: <stable@vger.kernel.org>
---
 drivers/scsi/qla2xxx/qla_isr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index dc88a09f9043..a94b0b6bd030 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3242,7 +3242,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
 	 * from a probe failure context.
 	 */
 	if (!ha->rsp_q_map || !ha->rsp_q_map[0])
-		return;
+		goto free_irqs;
 	rsp = ha->rsp_q_map[0];
 
 	if (ha->flags.msix_enabled) {
@@ -3262,6 +3262,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
 		free_irq(pci_irq_vector(ha->pdev, 0), rsp);
 	}
 
+free_irqs:
 	pci_free_irq_vectors(ha->pdev);
 }
 
-- 
2.11.0


       reply	other threads:[~2017-01-23 16:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170123163446.9227-1-bart.vanassche@sandisk.com>
2017-01-23 16:34 ` Bart Van Assche [this message]
2017-01-23 16:45   ` [PATCH 1/2] qla2xxx: Fix a recently introduced memory leak Christoph Hellwig
2017-01-23 17:04   ` Madhani, Himanshu
2017-01-24 12:10   ` Johannes Thumshirn
2017-01-25 23:28   ` Martin K. Petersen
2017-01-23 16:34 ` [PATCH 2/2] qla2xxx: Avoid that issuing a LIP triggers a kernel crash Bart Van Assche
2017-01-23 17:41   ` Madhani, Himanshu
2017-01-24 12:12   ` Johannes Thumshirn
2017-01-24 14:59   ` Mauricio Faria de Oliveira
2017-01-25 22:05     ` Madhani, Himanshu
2017-01-25 23:29     ` Martin K. Petersen
2017-01-26  0:09       ` Mauricio Faria de Oliveira

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=20170123163446.9227-2-bart.vanassche@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=hch@lst.de \
    --cc=himanshu.madhani@cavium.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.hernandez@cavium.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).