Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: resolver: Fix device node refcount leakage in of_resolve_phandles()

In of_resolve_phandles(), refcount of device node @local_fixups will be
increased if the for_each_child_of_node() exits early, but nowhere to
decrease the refcount, so cause refcount leakage for the node.

Fix by using __free() on @local_fixups.

Fixes: da56d04c806a ("of/resolver: Switch to new local fixups format.")
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-9-93e3a2659aa7@quicinc.com
[robh: Use __free() instead]
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Zijun Hu and committed by
Rob Herring (Arm)
a46a0805 5275e8b5

+2 -1
+2 -1
drivers/of/resolver.c
··· 249 249 */ 250 250 int of_resolve_phandles(struct device_node *overlay) 251 251 { 252 - struct device_node *child, *local_fixups, *refnode; 252 + struct device_node *child, *refnode; 253 253 struct device_node *overlay_fixups; 254 + struct device_node __free(device_node) *local_fixups = NULL; 254 255 struct property *prop; 255 256 const char *refpath; 256 257 phandle phandle, phandle_delta;