提交 5a7ee55b 编写于 作者: L Linus Torvalds

Merge tag 'pci-v5.15-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull pci fix from Bjorn Helgaas:

 - Don't save msi_populate_sysfs() error code as dev->msi_irq_groups so
   we don't dereference the error code as a pointer (Wang Hai)

* tag 'pci-v5.15-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI/MSI: Handle msi_populate_sysfs() errors correctly
...@@ -535,6 +535,7 @@ static int msi_verify_entries(struct pci_dev *dev) ...@@ -535,6 +535,7 @@ static int msi_verify_entries(struct pci_dev *dev)
static int msi_capability_init(struct pci_dev *dev, int nvec, static int msi_capability_init(struct pci_dev *dev, int nvec,
struct irq_affinity *affd) struct irq_affinity *affd)
{ {
const struct attribute_group **groups;
struct msi_desc *entry; struct msi_desc *entry;
int ret; int ret;
...@@ -558,12 +559,14 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, ...@@ -558,12 +559,14 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
if (ret) if (ret)
goto err; goto err;
dev->msi_irq_groups = msi_populate_sysfs(&dev->dev); groups = msi_populate_sysfs(&dev->dev);
if (IS_ERR(dev->msi_irq_groups)) { if (IS_ERR(groups)) {
ret = PTR_ERR(dev->msi_irq_groups); ret = PTR_ERR(groups);
goto err; goto err;
} }
dev->msi_irq_groups = groups;
/* Set MSI enabled bits */ /* Set MSI enabled bits */
pci_intx_for_msi(dev, 0); pci_intx_for_msi(dev, 0);
pci_msi_set_enable(dev, 1); pci_msi_set_enable(dev, 1);
...@@ -691,6 +694,7 @@ static void msix_mask_all(void __iomem *base, int tsize) ...@@ -691,6 +694,7 @@ static void msix_mask_all(void __iomem *base, int tsize)
static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
int nvec, struct irq_affinity *affd) int nvec, struct irq_affinity *affd)
{ {
const struct attribute_group **groups;
void __iomem *base; void __iomem *base;
int ret, tsize; int ret, tsize;
u16 control; u16 control;
...@@ -730,12 +734,14 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, ...@@ -730,12 +734,14 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
msix_update_entries(dev, entries); msix_update_entries(dev, entries);
dev->msi_irq_groups = msi_populate_sysfs(&dev->dev); groups = msi_populate_sysfs(&dev->dev);
if (IS_ERR(dev->msi_irq_groups)) { if (IS_ERR(groups)) {
ret = PTR_ERR(dev->msi_irq_groups); ret = PTR_ERR(groups);
goto out_free; goto out_free;
} }
dev->msi_irq_groups = groups;
/* Set MSI-X enabled bits and unmask the function */ /* Set MSI-X enabled bits and unmask the function */
pci_intx_for_msi(dev, 0); pci_intx_for_msi(dev, 0);
dev->msix_enabled = 1; dev->msix_enabled = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册