Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/pseries/msi: Fix potential underflow and leak issue

pseries_irq_domain_alloc() allocates interrupts at parent's interrupt
domain. If it fails in the progress, all allocated interrupts are
freed.

The number of successfully allocated interrupts so far is stored
"i". However, "i - 1" interrupts are freed. This is broken:

- One interrupt is not be freed

- If "i" is zero, "i - 1" wraps around

Correct the number of freed interrupts to 'i'.

Fixes: a5f3d2c17b07 ("powerpc/pseries/pci: Add MSI domains")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: stable@vger.kernel.org
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/a980067f2b256bf716b4cd713bc1095966eed8cd.1754300646.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Madhavan Srinivasan
3443ff3b 4f61d54d

+1 -1
+1 -1
arch/powerpc/platforms/pseries/msi.c
··· 593 593 594 594 out: 595 595 /* TODO: handle RTAS cleanup in ->msi_finish() ? */ 596 - irq_domain_free_irqs_parent(domain, virq, i - 1); 596 + irq_domain_free_irqs_parent(domain, virq, i); 597 597 return ret; 598 598 } 599 599