Skip to content

Commit

Permalink
xen/events: fix error code in xen_bind_pirq_msi_to_irq()
Browse files Browse the repository at this point in the history
commit 7f3da4b upstream.

Return -ENOMEM if xen_irq_init() fails.  currently the code returns an
uninitialized variable or zero.

Fixes: 5dd9ad3 ("xen/events: drop xen_allocate_irqs_dynamic()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Juergen Gross <jgross@ssue.com>
Link: https://lore.kernel.org/r/3b9ab040-a92e-4e35-b687-3a95890a9ace@moroto.mountain
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Mar 1, 2024
1 parent 658750e commit 980278a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/xen/events/events_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,10 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,

for (i = 0; i < nvec; i++) {
info = xen_irq_init(irq + i);
if (!info)
if (!info) {
ret = -ENOMEM;
goto error_irq;
}

irq_set_chip_and_handler_name(irq + i, &xen_pirq_chip, handle_edge_irq, name);

Expand Down

0 comments on commit 980278a

Please sign in to comment.