Skip to content

Commit eff4780

Browse files
YuuoniyMarc Zyngier
authored andcommitted
irqchip/realtek-rtl: Fix refcount leak in map_interrupts
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: 9f3a0f3 ("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
1 parent fa1ad9d commit eff4780

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/irqchip/irq-realtek-rtl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do
134134
if (!cpu_ictl)
135135
return -EINVAL;
136136
ret = of_property_read_u32(cpu_ictl, "#interrupt-cells", &tmp);
137+
of_node_put(cpu_ictl);
137138
if (ret || tmp != 1)
138139
return -EINVAL;
139-
of_node_put(cpu_ictl);
140140

141141
cpu_int = be32_to_cpup(imap + 2);
142142
if (cpu_int > 7 || cpu_int < 2)

0 commit comments

Comments
 (0)