* [bug report] vdpa/octeon_ep: enable support for multiple interrupts per device
@ 2025-10-15 9:49 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-10-15 9:49 UTC (permalink / raw)
To: Shijith Thotton; +Cc: virtualization
Hello Shijith Thotton,
Commit 26f8ce06af64 ("vdpa/octeon_ep: enable support for multiple
interrupts per device") from Jan 3, 2025 (linux-next), leads to the
following issue:
drivers/vdpa/octeon_ep/octep_vdpa_main.c:114: ret = pci_alloc_irq_vectors(pdev, 1, oct_hw->nb_irqs, PCI_IRQ_MSIX);
This assumes that pci_alloc_irq_vectors() allocates the maximum.
drivers/vdpa/octeon_ep/octep_vdpa_main.c
104
105 static int octep_request_irqs(struct octep_hw *oct_hw)
106 {
107 struct pci_dev *pdev = oct_hw->pdev;
108 int ret, irq, idx;
109
110 oct_hw->irqs = devm_kcalloc(&pdev->dev, oct_hw->nb_irqs, sizeof(int), GFP_KERNEL);
111 if (!oct_hw->irqs)
112 return -ENOMEM;
113
--> 114 ret = pci_alloc_irq_vectors(pdev, 1, oct_hw->nb_irqs, PCI_IRQ_MSIX);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The pci_alloc_irq_vectors() takes a range between 1 and oct_hw->nb_irqs.
If it can't allocate the minimum (1) it will return a negative error
code, otherwise it will return a number between 1 and oct_hw->nb_irqs
inclusive.
115 if (ret < 0) {
116 dev_err(&pdev->dev, "Failed to alloc msix vector");
117 return ret;
118 }
119
120 for (idx = 0; idx < oct_hw->nb_irqs; idx++) {
^^^^^^^^^^^^^^^
This should be "ret". We can't assume it allocated all the irq
vectors.
121 irq = pci_irq_vector(pdev, idx);
122 ret = devm_request_irq(&pdev->dev, irq, octep_vdpa_intr_handler, 0,
123 dev_name(&pdev->dev), oct_hw);
124 if (ret) {
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-15 9:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 9:49 [bug report] vdpa/octeon_ep: enable support for multiple interrupts per device Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).