]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc/powernv/pci: Fix underflow and leak issue
authorNam Cao <namcao@linutronix.de>
Mon, 4 Aug 2025 10:07:28 +0000 (12:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:23:15 +0000 (16:23 +0200)
commit8fc674976f57a680eb1276c95c9c94798166246e
tree4e17ce018639ad328c7e91922b08bd119e9a532d
parent07f4a3a9cb69ec09b6625663684cc8444686b70d
powerpc/powernv/pci: Fix underflow and leak issue

commit a39087905af9ffecaa237a918a2c03a04e479934 upstream.

pnv_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: 0fcfe2247e75 ("powerpc/powernv/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/70f8debe8688e0b467367db769b71c20146a836d.1754300646.git.namcao@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/powernv/pci-ioda.c