irqchip/realtek-rtl: Fix refcount leak in map_interrupts
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 1 Jun 2022 08:09:30 +0000 (12:09 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jun 2022 12:22:02 +0000 (14:22 +0200)
commite85b1b797de0e7a271b906291ce28245822820b8
tree5a0570b5eabe8b7fc351ce68723b1ae8e8f16283
parentcc5984cf270b69d03f9f4b27063e535036c659e9
irqchip/realtek-rtl: Fix refcount leak in map_interrupts

[ Upstream commit eff4780f83d0ae3e5b6c02ff5d999dc4c1c5c8ce ]

of_find_node_by_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
This function doesn't call of_node_put() in error path.
Call of_node_put() directly after of_property_read_u32() to cover
both normal path and error path.

Fixes: 9f3a0f34b84a ("irqchip: Add support for Realtek RTL838x/RTL839x interrupt controller")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220601080930.31005-7-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/irqchip/irq-realtek-rtl.c