Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
Merge tag 'irq_urgent_for_v6.2_rc6' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/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()
  • Loading branch information
torvalds committed Jan 29, 2023
2 parents bc6bc34 + ac8f29a commit ab07268
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kernel/irq/irqdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode)
{
struct irqchip_fwid *fwid;

if (WARN_ON(!is_fwnode_irqchip(fwnode)))
if (!fwnode || WARN_ON(!is_fwnode_irqchip(fwnode)))
return;

fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
Expand Down
6 changes: 5 additions & 1 deletion kernel/irq/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
fail:
msi_unlock_descs(dev);
free_fwnode:
kfree(fwnode);
irq_domain_free_fwnode(fwnode);
free_bundle:
kfree(bundle);
return false;
Expand All @@ -1013,6 +1013,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
*/
void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
{
struct fwnode_handle *fwnode = NULL;
struct msi_domain_info *info;
struct irq_domain *domain;

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

dev->msi.data->__domains[domid].domain = NULL;
info = domain->host_data;
if (irq_domain_is_msi_device(domain))
fwnode = domain->fwnode;
irq_domain_remove(domain);
irq_domain_free_fwnode(fwnode);
kfree(container_of(info, struct msi_domain_template, info));

unlock:
Expand Down

0 comments on commit ab07268

Please sign in to comment.