Skip to content

Commit ab07268

Browse files
committed
Merge tag 'irq_urgent_for_v6.2_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fix from Borislav Petkov: - Cleanup the firmware node for the new IRQ MSI domain properly, to avoid leaking memory * tag 'irq_urgent_for_v6.2_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: genirq/msi: Free the fwnode created by msi_create_device_irq_domain()
2 parents bc6bc34 + ac8f29a commit ab07268

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

kernel/irq/irqdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode)
114114
{
115115
struct irqchip_fwid *fwid;
116116

117-
if (WARN_ON(!is_fwnode_irqchip(fwnode)))
117+
if (!fwnode || WARN_ON(!is_fwnode_irqchip(fwnode)))
118118
return;
119119

120120
fwid = container_of(fwnode, struct irqchip_fwid, fwnode);

kernel/irq/msi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
10001000
fail:
10011001
msi_unlock_descs(dev);
10021002
free_fwnode:
1003-
kfree(fwnode);
1003+
irq_domain_free_fwnode(fwnode);
10041004
free_bundle:
10051005
kfree(bundle);
10061006
return false;
@@ -1013,6 +1013,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
10131013
*/
10141014
void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
10151015
{
1016+
struct fwnode_handle *fwnode = NULL;
10161017
struct msi_domain_info *info;
10171018
struct irq_domain *domain;
10181019

@@ -1025,7 +1026,10 @@ void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
10251026

10261027
dev->msi.data->__domains[domid].domain = NULL;
10271028
info = domain->host_data;
1029+
if (irq_domain_is_msi_device(domain))
1030+
fwnode = domain->fwnode;
10281031
irq_domain_remove(domain);
1032+
irq_domain_free_fwnode(fwnode);
10291033
kfree(container_of(info, struct msi_domain_template, info));
10301034

10311035
unlock:

0 commit comments

Comments
 (0)