mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
powerpc/xive: Fix refcount leak in xive_spapr_init
[ Upstream commit1d1fb9618b
] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes:eac1e731b5
("powerpc/xive: guest exploitation of the XIVE interrupt controller") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220512090535.33397-1-linmq006@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fd7a3548af
commit
65f11ccdd7
@ -830,12 +830,12 @@ bool __init xive_spapr_init(void)
|
||||
/* Resource 1 is the OS ring TIMA */
|
||||
if (of_address_to_resource(np, 1, &r)) {
|
||||
pr_err("Failed to get thread mgmnt area resource\n");
|
||||
return false;
|
||||
goto err_put;
|
||||
}
|
||||
tima = ioremap(r.start, resource_size(&r));
|
||||
if (!tima) {
|
||||
pr_err("Failed to map thread mgmnt area\n");
|
||||
return false;
|
||||
goto err_put;
|
||||
}
|
||||
|
||||
if (!xive_get_max_prio(&max_prio))
|
||||
@ -871,6 +871,7 @@ bool __init xive_spapr_init(void)
|
||||
if (!xive_core_init(np, &xive_spapr_ops, tima, TM_QW1_OS, max_prio))
|
||||
goto err_mem_free;
|
||||
|
||||
of_node_put(np);
|
||||
pr_info("Using %dkB queues\n", 1 << (xive_queue_shift - 10));
|
||||
return true;
|
||||
|
||||
@ -878,6 +879,8 @@ err_mem_free:
|
||||
xive_irq_bitmap_remove_all();
|
||||
err_unmap:
|
||||
iounmap(tima);
|
||||
err_put:
|
||||
of_node_put(np);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user