linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Bixuan Cui <cuibixuan@huawei.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 5.4 47/62] genirq/msi: Ensure deactivation on teardown
Date: Mon, 16 Aug 2021 15:02:19 +0200	[thread overview]
Message-ID: <20210816125429.820363920@linuxfoundation.org> (raw)
In-Reply-To: <20210816125428.198692661@linuxfoundation.org>

From: Bixuan Cui <cuibixuan@huawei.com>

commit dbbc93576e03fbe24b365fab0e901eb442237a8a upstream.

msi_domain_alloc_irqs() invokes irq_domain_activate_irq(), but
msi_domain_free_irqs() does not enforce deactivation before tearing down
the interrupts.

This happens when PCI/MSI interrupts are set up and never used before being
torn down again, e.g. in error handling pathes. The only place which cleans
that up is the error handling path in msi_domain_alloc_irqs().

Move the cleanup from msi_domain_alloc_irqs() into msi_domain_free_irqs()
to cure that.

Fixes: f3b0946d629c ("genirq/msi: Make sure PCI MSIs are activated early")
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210518033117.78104-1-cuibixuan@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/irq/msi.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -477,11 +477,6 @@ skip_activate:
 	return 0;
 
 cleanup:
-	for_each_msi_vector(desc, i, dev) {
-		irq_data = irq_domain_get_irq_data(domain, i);
-		if (irqd_is_activated(irq_data))
-			irq_domain_deactivate_irq(irq_data);
-	}
 	msi_domain_free_irqs(domain, dev);
 	return ret;
 }
@@ -494,7 +489,15 @@ cleanup:
  */
 void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev)
 {
+	struct irq_data *irq_data;
 	struct msi_desc *desc;
+	int i;
+
+	for_each_msi_vector(desc, i, dev) {
+		irq_data = irq_domain_get_irq_data(domain, i);
+		if (irqd_is_activated(irq_data))
+			irq_domain_deactivate_irq(irq_data);
+	}
 
 	for_each_msi_entry(desc, dev) {
 		/*



  parent reply	other threads:[~2021-08-16 13:05 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 13:01 [PATCH 5.4 00/62] 5.4.142-rc1 review Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 01/62] iio: adc: ti-ads7950: Ensure CS is deasserted after reading channels Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 02/62] iio: humidity: hdc100x: Add margin to the conversion time Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 03/62] iio: adc: Fix incorrect exit of for-loop Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 04/62] ASoC: xilinx: Fix reference to PCM buffer address Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 05/62] ASoC: intel: atom: " Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 06/62] i2c: dev: zero out array used for i2c reads from userspace Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 07/62] ceph: reduce contention in ceph_check_delayed_caps() Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 08/62] ACPI: NFIT: Fix support for virtual SPA ranges Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 09/62] libnvdimm/region: Fix label activation vs errors Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 10/62] ieee802154: hwsim: fix GPF in hwsim_set_edge_lqi Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 11/62] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 12/62] ASoC: cs42l42: Correct definition of ADC Volume control Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 13/62] ASoC: cs42l42: Dont allow SND_SOC_DAIFMT_LEFT_J Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 14/62] ASoC: cs42l42: Fix inversion of ADC Notch Switch control Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 15/62] ASoC: cs42l42: Remove duplicate control for WNF filter frequency Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 16/62] netfilter: nf_conntrack_bridge: Fix memory leak when error Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 17/62] ASoC: cs42l42: Fix LRCLK frame start edge Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 18/62] net: dsa: mt7530: add the missing RxUnicast MIB counter Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 19/62] platform/x86: pcengines-apuv2: revert wiring up simswitch GPIO as LED Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 20/62] platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 21/62] net: phy: micrel: Fix link detection on ksz87xx switch" Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 22/62] ppp: Fix generating ifname when empty IFLA_IFNAME is specified Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 23/62] net: sched: act_mirred: Reset ct info when mirror/redirect skb Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 24/62] iavf: Set RSS LUT and key in reset handle path Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 25/62] psample: Add a fwd declaration for skbuff Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 26/62] net/mlx5: Fix return value from tracer initialization Greg Kroah-Hartman
2021-08-16 13:01 ` [PATCH 5.4 27/62] drm/meson: fix colour distortion from HDR set during vendor u-boot Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 28/62] net: dsa: microchip: Fix ksz_read64() Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 29/62] net: Fix memory leak in ieee802154_raw_deliver Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 30/62] net: igmp: fix data-race in igmp_ifc_timer_expire() Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 31/62] net: dsa: lan9303: fix broken backpressure in .port_fdb_dump Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 32/62] net: dsa: lantiq: " Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 33/62] net: dsa: sja1105: " Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 34/62] net: bridge: fix memleak in br_add_if() Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 35/62] net: linkwatch: fix failure to restore device state across suspend/resume Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 36/62] tcp_bbr: fix u32 wrap bug in round logic if bbr_init() called after 2B packets Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 37/62] net: igmp: increase size of mr_ifc_count Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 38/62] xen/events: Fix race in set_evtchn_to_irq Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 39/62] vsock/virtio: avoid potential deadlock when vsock device remove Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 40/62] nbd: Aovid double completion of a request Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 41/62] powerpc/kprobes: Fix kprobe Oops happens in booke Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 42/62] x86/tools: Fix objdump version check again Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 43/62] genirq: Provide IRQCHIP_AFFINITY_PRE_STARTUP Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 44/62] x86/msi: Force affinity setup before startup Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 45/62] x86/ioapic: " Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 46/62] x86/resctrl: Fix default monitoring groups reporting Greg Kroah-Hartman
2021-08-16 13:02 ` Greg Kroah-Hartman [this message]
2021-08-16 13:02 ` [PATCH 5.4 48/62] genirq/timings: Prevent potential array overflow in __irq_timings_store() Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 49/62] PCI/MSI: Enable and mask MSI-X early Greg Kroah-Hartman
2021-08-17  7:36   ` Pavel Machek
2021-08-18  6:53     ` Greg Kroah-Hartman
2021-08-18  9:19       ` Greg Kroah-Hartman
2021-08-18 19:30         ` Pavel Machek
2021-08-16 13:02 ` [PATCH 5.4 50/62] PCI/MSI: Mask all unused MSI-X entries Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 51/62] PCI/MSI: Enforce that MSI-X table entry is masked for update Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 52/62] PCI/MSI: Enforce MSI[X] entry updates to be visible Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 53/62] PCI/MSI: Do not set invalid bits in MSI mask Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 54/62] PCI/MSI: Correct misleading comments Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 55/62] PCI/MSI: Use msi_mask_irq() in pci_msi_shutdown() Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 56/62] PCI/MSI: Protect msi_desc::masked for multi-MSI Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 57/62] KVM: VMX: Use current VMCS to query WAITPKG support for MSR emulation Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 58/62] ceph: add some lockdep assertions around snaprealm handling Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 59/62] ceph: clean up locking annotation for ceph_get_snap_realm and __lookup_snap_realm Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 60/62] ceph: take snap_empty_lock atomically with snaprealm refcount change Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 61/62] vmlinux.lds.h: Handle clangs module.{c,d}tor sections Greg Kroah-Hartman
2021-08-16 13:02 ` [PATCH 5.4 62/62] iommu/vt-d: Fix agaw for a supported 48 bit guest address width Greg Kroah-Hartman

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=20210816125429.820363920@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=cuibixuan@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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).