Thomas Gleixner
a0af3d1104
PCI/MSI: Prevent UAF in error path
...
When the core MSI allocation fails, then the PCI/MSI code uses an already
freed MSI descriptor to unmask the MSI mask register in order to bring it back
into reset state.
Remove MSI_FLAG_FREE_MSI_DESCS from the PCI/MSI irqdomain flags and let the
PCI/MSI code free the MSI descriptors after usage.
Fixes: 0f62d941ac ("genirq/msi: Provide msi_domain_alloc/free_irqs_descs_locked()")
Reported-by: Tong Zhang <ztong0001@gmail.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tong Zhang <ztong0001@gmail.com >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/87r1938vbn.ffs@tglx
2022-01-21 02:14:46 +01:00
Thomas Gleixner
ae24e28fef
PCI/MSI: Use msi_on_each_desc()
...
Use the new iterator functions which pave the way for dynamically extending
MSI-X vectors.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Michael Kelley <mikelley@microsoft.com >
Tested-by: Nishanth Menon <nm@ti.com >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/20211206210748.142603657@linutronix.de
2021-12-16 22:22:18 +01:00
Thomas Gleixner
9fb9eb4b59
PCI/MSI: Let core code free MSI descriptors
...
Set the domain info flag which tells the core code to free the MSI
descriptors from msi_domain_free_irqs() and add an explicit call to the
core function into the legacy code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Michael Kelley <mikelley@microsoft.com >
Tested-by: Nishanth Menon <nm@ti.com >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/20211206210748.089085131@linutronix.de
2021-12-16 22:22:17 +01:00
Thomas Gleixner
ffd84485e6
PCI/MSI: Let the irq code handle sysfs groups
...
Set the domain info flag which makes the core code handle sysfs groups and
put an explicit invocation into the legacy code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Michael Kelley <mikelley@microsoft.com >
Tested-by: Nishanth Menon <nm@ti.com >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/20211210221814.048612053@linutronix.de
2021-12-16 22:16:39 +01:00
Thomas Gleixner
60bf9b33c8
PCI/MSI: Move descriptor counting on allocation fail to the legacy code
...
The irqdomain code already returns the information. Move the loop to the
legacy code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20211206210225.101336873@linutronix.de
2021-12-09 11:52:23 +01:00
Thomas Gleixner
aa423ac422
PCI/MSI: Split out irqdomain code
...
Move the irqdomain specific code into its own file.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/20211206210224.817754783@linutronix.de
2021-12-09 11:52:22 +01:00
Thomas Gleixner
a01e09ef12
PCI/MSI: Split out !IRQDOMAIN code
...
Split out the non irqdomain code into its own file.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/20211206210224.763574089@linutronix.de
2021-12-09 11:52:22 +01:00