All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: Bjorn Helgaas <helgaas@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ley Foon Tan <ley.foon.tan@intel.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Jingoo Han <jingoohan1@gmail.com>,
	Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
	Toan Le <toan@os.amperecomputing.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH v3 3/3] PCI: xgene-msi: Fix race in installing chained irq handler
Date: Thu, 12 Nov 2020 23:10:10 +0100	[thread overview]
Message-ID: <20201112221010.9473-3-martin@kaiser.cx> (raw)
In-Reply-To: <20201112221010.9473-1-martin@kaiser.cx>

Fix a race where a pending interrupt could be received and the handler
called before the handler's data has been setup, by converting to
irq_set_chained_handler_and_data().

See also 2cf5a03cb29d ("PCI/keystone: Fix race in installing chained IRQ
handler").

Based on the mail discussion, it seems ok to drop the error handling.

Link: https://lore.kernel.org/linux-pci/87h7pumo9l.fsf@nanos.tec.linutronix.de/T/#m6d3288531114ada1378b41538ef73fef451f1441
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/pci/controller/pci-xgene-msi.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c
index 2470782cb01a..1c34c897a7e2 100644
--- a/drivers/pci/controller/pci-xgene-msi.c
+++ b/drivers/pci/controller/pci-xgene-msi.c
@@ -384,13 +384,9 @@ static int xgene_msi_hwirq_alloc(unsigned int cpu)
 		if (!msi_group->gic_irq)
 			continue;
 
-		irq_set_chained_handler(msi_group->gic_irq,
-					xgene_msi_isr);
-		err = irq_set_handler_data(msi_group->gic_irq, msi_group);
-		if (err) {
-			pr_err("failed to register GIC IRQ handler\n");
-			return -EINVAL;
-		}
+		irq_set_chained_handler_and_data(msi_group->gic_irq,
+			xgene_msi_isr, msi_group);
+
 		/*
 		 * Statically allocate MSI GIC IRQs to each CPU core.
 		 * With 8-core X-Gene v1, 2 MSI GIC IRQs are allocated
-- 
2.20.1


  parent reply	other threads:[~2020-11-12 22:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08 19:11 [PATCH] PCI: altera-msi: Remove irq handler and data in one go Martin Kaiser
2020-11-10 21:21 ` Bjorn Helgaas
2020-11-10 21:45   ` Bjorn Helgaas
2020-11-11 21:43     ` Martin Kaiser
2020-11-11 22:16       ` Bjorn Helgaas
2020-11-12 11:28         ` Thomas Gleixner
2020-11-12 13:50           ` Thomas Gleixner
2020-11-12 14:26             ` Bjorn Helgaas
2020-11-12 18:19               ` Thomas Gleixner
2020-11-11 22:01 ` [PATCH v2 1/2] PCI: altera-msi: Fix race in removing chained IRQ handler Martin Kaiser
2020-11-11 22:01   ` [PATCH v2 2/2] PCI: dwc: " Martin Kaiser
2020-11-12 22:10 ` [PATCH v3 1/3] PCI: altera-msi: remove chained IRQ handler and data in one go Martin Kaiser
2020-11-12 22:10   ` [PATCH v3 2/3] PCI: dwc: " Martin Kaiser
2020-11-12 22:10   ` Martin Kaiser [this message]
2020-11-13 16:54   ` [PATCH v3 1/3] PCI: altera-msi: " Bjorn Helgaas
2021-01-15 21:24 ` [PATCH v4 1/3] PCI: altera-msi: Remove " Martin Kaiser
2021-01-15 21:24   ` [PATCH v4 2/3] PCI: dwc: " Martin Kaiser
2021-01-15 21:24   ` [PATCH v4 3/3] PCI: xgene-msi: Fix race in installing chained irq handler Martin Kaiser
2021-01-18 15:49   ` [PATCH v4 1/3] PCI: altera-msi: Remove IRQ handler and data in one go Lorenzo Pieralisi

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=20201112221010.9473-3-martin@kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=f.fainelli@gmail.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=helgaas@kernel.org \
    --cc=jingoohan1@gmail.com \
    --cc=ley.foon.tan@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=tglx@linutronix.de \
    --cc=toan@os.amperecomputing.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.