[PATCH] sparc64: Fix leaked platform_device reference in schizo_register_error_handlers()
From: Ma Ke
Date: Sun Oct 11 2026 - 06:24:38 EST
of_find_device_by_node() is documented in drivers/of/platform.c:
* Takes a reference to the embedded struct device which needs to be
* dropped after use.
schizo_register_error_handlers() looks up the platform device backing
the PBM and never drops that reference.
tomatillo_register_error_handlers() in the same file has the leak.
Release the reference once the error interrupts have been registered.
Found by code review.
Fixes: 22fecbae4446 ("sparc64: Record OF device instead of device node pointer in pci_pbm_info.")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ma Ke <make_ruc2021@xxxxxxx>
---
arch/sparc/kernel/pci_schizo.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 4348ca2c4a3f..a8db997675cc 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1050,6 +1050,8 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
upa_writeq((SCHIZO_SAFERRCTRL_EN | err_mask),
pbm->controller_regs + SCHIZO_SAFARI_ERRCTRL);
+
+ platform_device_put(op);
}
static void pbm_config_busmastering(struct pci_pbm_info *pbm)
--
2.43.0