]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
powerpc/pseries/msi: Fix potential underflow and leak issue
authorNam Cao <namcao@linutronix.de>
Mon, 4 Aug 2025 10:07:27 +0000 (12:07 +0200)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Mon, 1 Sep 2025 08:09:39 +0000 (13:39 +0530)
commit3443ff3be6e59b80d74036bb39f5b6409eb23cc9
tree3cd77d98c6b90daccfee3d9e3abee43d1a49f2c2
parent4f61d54d2245c15b23ad78a89f854fb2496b6216
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
arch/powerpc/platforms/pseries/msi.c