From: "tip-bot2 for Lorenzo Pieralisi" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org
Subject: [tip: irq/urgent] irqchip/msi-lib: Fix fwnode refcount in msi_lib_irq_domain_select()
Date: Tue, 05 Aug 2025 08:37:11 -0000 [thread overview]
Message-ID: <175438303167.1420.5717276327513012044.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250804145553.795065-1-lpieralisi@kernel.org>
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 02cbf8e0692bd30717b35a3ff5e46460d1d5d471
Gitweb: https://git.kernel.org/tip/02cbf8e0692bd30717b35a3ff5e46460d1d5d471
Author: Lorenzo Pieralisi <lpieralisi@kernel.org>
AuthorDate: Mon, 04 Aug 2025 16:55:53 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 05 Aug 2025 10:31:46 +02:00
irqchip/msi-lib: Fix fwnode refcount in msi_lib_irq_domain_select()
Commit 8b65db1e93a2 ("irqchip/msi-lib: Add IRQ_DOMAIN_FLAG_FWNODE_PARENT
handling") added logic in msi_lib_irq_domain_select() to match the domain
fwnode against the fwnode parent of the fwspec.fwnode.
The fwnode_get_parent() caller must call fwnode_handle_put() on the
returned pointer value, lest fwnode refcounting for the parent ends up
being out of kilter.
Fix this by relying on the fwnode_handle clean-up handlers and by
incrementing the fwnode refcount regardless of whether parent matching is
used or not (the domain selection code already holds a reference before
calling msi_lib_irq_domain_select() but to make the exit path more uniform
if IRQ_DOMAIN_FLAG_FWNODE_PARENT is not set fwnode_handle_get() is called
again on fwspec.fwnode so that the clean-up code is the same for the two
matching patterns).
Fixes: 8b65db1e93a2 ("irqchip/msi-lib: Add IRQ_DOMAIN_FLAG_FWNODE_PARENT handling")
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250804145553.795065-1-lpieralisi@kernel.org
---
drivers/irqchip/irq-msi-lib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-msi-lib.c b/drivers/irqchip/irq-msi-lib.c
index 454c7f1..9089440 100644
--- a/drivers/irqchip/irq-msi-lib.c
+++ b/drivers/irqchip/irq-msi-lib.c
@@ -133,13 +133,13 @@ int msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec,
{
const struct msi_parent_ops *ops = d->msi_parent_ops;
u32 busmask = BIT(bus_token);
- struct fwnode_handle *fwh;
if (!ops)
return 0;
- fwh = d->flags & IRQ_DOMAIN_FLAG_FWNODE_PARENT ? fwnode_get_parent(fwspec->fwnode)
- : fwspec->fwnode;
+ struct fwnode_handle *fwh __free(fwnode_handle) =
+ d->flags & IRQ_DOMAIN_FLAG_FWNODE_PARENT ? fwnode_get_parent(fwspec->fwnode)
+ : fwnode_handle_get(fwspec->fwnode);
if (fwh != d->fwnode || fwspec->param_count != 0)
return 0;
prev parent reply other threads:[~2025-08-05 8:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 14:55 [PATCH] " Lorenzo Pieralisi
2025-08-05 8:31 ` Thomas Gleixner
2025-08-05 9:23 ` Lorenzo Pieralisi
2025-08-06 14:08 ` Jonathan Cameron
2025-08-07 13:40 ` Lorenzo Pieralisi
2025-08-05 8:37 ` tip-bot2 for Lorenzo Pieralisi [this message]
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=175438303167.1420.5717276327513012044.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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
all inboxes | Powered by JetHome®