linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "hch@lst.de" <hch@lst.de>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>
Cc: "hch@lst.de" <hch@lst.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 1/2] qla2xxx: Fix a recently introduced memory leak
Date: Sun, 29 Jan 2017 10:07:36 +0100	[thread overview]
Message-ID: <20170129090736.GA10369@lst.de> (raw)
In-Reply-To: <1485667034.15853.1.camel@sandisk.com>

Hi Bart,

thanks for the analysis.  I think the main issue here is that we shouldn't
try to assign affinity masks if there are not affinity vectors left to
assign.

Does the patch below fix the issue for you?

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 50c5003..96c0713 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1206,6 +1206,11 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 	if (flags & PCI_IRQ_AFFINITY) {
 		if (!affd)
 			affd = &msi_default_affd;
+
+		if (affd->pre_vectors + affd->post_vectors > min_vecs)
+			return -EINVAL;
+		if (affd->pre_vectors + affd->post_vectors == min_vecs)
+			flags &=~ PCI_IRQ_AFFINITY;
 	} else {
 		if (WARN_ON(affd))
 			affd = NULL;

  reply	other threads:[~2017-01-29 13:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 16:34 [PATCH 0/2] qla2xxx: Two bug fixes Bart Van Assche
2017-01-23 16:34 ` [PATCH 1/2] qla2xxx: Fix a recently introduced memory leak Bart Van Assche
2017-01-23 16:45   ` Christoph Hellwig
2017-01-23 17:04   ` Madhani, Himanshu
2017-01-24 12:10   ` Johannes Thumshirn
2017-01-25 15:47   ` Bart Van Assche
2017-01-26 14:36     ` hch
2017-01-29  5:17       ` Bart Van Assche
2017-01-29  9:07         ` hch [this message]
2017-01-29 17:14           ` Bart Van Assche
2017-01-25 23:28   ` Martin K. Petersen
2017-02-03 16:59     ` Bart Van Assche
2017-02-07  0:23       ` 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=20170129090736.GA10369@lst.de \
    --to=hch@lst.de \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=linux-scsi@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).