diff options
| author | Nam Cao <[email protected]> | 2025-08-07 08:10:51 +0000 |
|---|---|---|
| committer | Bjorn Helgaas <[email protected]> | 2025-08-07 16:30:12 +0000 |
| commit | d5c647b08ee02cb7fa50d89414ed0f5dc7c1ca0e (patch) | |
| tree | f5970daeddae0eb5aa213e610c4cab86528e8da8 /drivers/pci/controller/vmd.c | |
| parent | Merge tag 'pci-v6.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff) | |
| download | kernel-d5c647b08ee02cb7fa50d89414ed0f5dc7c1ca0e.tar.gz kernel-d5c647b08ee02cb7fa50d89414ed0f5dc7c1ca0e.zip | |
PCI: vmd: Fix wrong kfree() in vmd_msi_free()
vmd_msi_alloc() allocates struct vmd_irq and stashes it into
irq_data->chip_data associated with the VMD's interrupt domain.
vmd_msi_free() extracts the pointer by calling irq_get_chip_data() and
frees it.
irq_get_chip_data() returns the chip_data associated with the top interrupt
domain. This worked in the past because VMD's interrupt domain was the top
domain.
But d7d8ab87e3e7 ("PCI: vmd: Switch to msi_create_parent_irq_domain()")
changed the interrupt domain hierarchy so VMD's interrupt domain is not the
top domain anymore. irq_get_chip_data() now returns the chip_data at the
MSI devices' interrupt domains. It is therefore broken for vmd_msi_free()
to kfree() this chip_data.
Fix by extracting the chip_data associated with the VMD's interrupt domain.
Fixes: d7d8ab87e3e7 ("PCI: vmd: Switch to msi_create_parent_irq_domain()")
Reported-by: Kenneth Crudup <[email protected]>
Closes: https://lore.kernel.org/linux-pci/[email protected]/
Reported-by: Ammar Faizi <[email protected]>
Closes: https://lore.kernel.org/linux-pci/ed53280ed15d1140700b96cca2734bf327ee92539e5eb68e80f5bbbf0f01@linux.gnuweeb.org/
Tested-by: Ammar Faizi <[email protected]>
Tested-by: Kenneth Crudup <[email protected]>
Signed-off-by: Nam Cao <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Reviewed-by: Jinjie Ruan <[email protected]>
Acked-by: Manivannan Sadhasivam <[email protected]>
Link: https://patch.msgid.link/[email protected]
Diffstat (limited to 'drivers/pci/controller/vmd.c')
| -rw-r--r-- | drivers/pci/controller/vmd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 9bbb0ff4cc15..b679c7f28f51 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -280,10 +280,12 @@ static int vmd_msi_alloc(struct irq_domain *domain, unsigned int virq, static void vmd_msi_free(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs) { + struct irq_data *irq_data; struct vmd_irq *vmdirq; for (int i = 0; i < nr_irqs; ++i) { - vmdirq = irq_get_chip_data(virq + i); + irq_data = irq_domain_get_irq_data(domain, virq + i); + vmdirq = irq_data->chip_data; synchronize_srcu(&vmdirq->irq->srcu); |
