Re: [PATCH] RISC-V: Fix of_node_* refcount
From: Andreas Schwab
Date: Mon Jan 07 2019 - 08:33:09 EST
On Nov 20 2018, Atish Patra <atish.patra@xxxxxxx> wrote:
> diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
> index 18cda0e8..fc185eca 100644
> --- a/arch/riscv/kernel/smpboot.c
> +++ b/arch/riscv/kernel/smpboot.c
> @@ -57,12 +57,15 @@ void __init setup_smp(void)
>
> while ((dn = of_find_node_by_type(dn, "cpu"))) {
> hart = riscv_of_processor_hartid(dn);
> - if (hart < 0)
> + if (hart < 0) {
> + of_node_put(dn);
> continue;
> + }
>
> if (hart == cpuid_to_hartid_map(0)) {
> BUG_ON(found_boot_cpu);
> found_boot_cpu = 1;
> + of_node_put(dn);
> continue;
> }
>
[ 0.000000] OF: ERROR: Bad of_node_put() on /cpus/cpu@0
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc1-00013-ge0b3e41110 #4
[ 0.000000] Call Trace:
[ 0.000000] [<ffffffe0010c8c74>] walk_stackframe+0x0/0xa4
[ 0.000000] [<ffffffe0010c8e74>] show_stack+0x2a/0x34
[ 0.000000] [<ffffffe00160989c>] dump_stack+0x62/0x7c
[ 0.000000] [<ffffffe0014d9660>] of_node_release+0xbe/0xc0
[ 0.000000] [<ffffffe00160e560>] kobject_put+0xa6/0x1e8
[ 0.000000] [<ffffffe0014d8bb8>] of_node_put+0x16/0x20
[ 0.000000] [<ffffffe0014d4bc2>] of_find_node_by_type+0x66/0xa4
[ 0.000000] [<ffffffe0000028bc>] 0xffffffe0000028bc
[ 0.000000] [<ffffffe0000026cc>] 0xffffffe0000026cc
[ 0.000000] [<ffffffe0000006ec>] 0xffffffe0000006ec
[ 0.000000] [<ffffffe000000076>] 0xffffffe000000076
[ 0.000000] OF: ERROR: Bad of_node_put() on /cpus/cpu@1
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc1-00013-ge0b3e41110 #4
[ 0.000000] Call Trace:
[ 0.000000] [<ffffffe0010c8c74>] walk_stackframe+0x0/0xa4
[ 0.000000] [<ffffffe0010c8e74>] show_stack+0x2a/0x34
[ 0.000000] [<ffffffe00160989c>] dump_stack+0x62/0x7c
[ 0.000000] [<ffffffe0014d9660>] of_node_release+0xbe/0xc0
[ 0.000000] [<ffffffe00160e560>] kobject_put+0xa6/0x1e8
[ 0.000000] [<ffffffe0014d8bb8>] of_node_put+0x16/0x20
[ 0.000000] [<ffffffe0014d4bc2>] of_find_node_by_type+0x66/0xa4
[ 0.000000] [<ffffffe0000028bc>] 0xffffffe0000028bc
[ 0.000000] [<ffffffe0000026cc>] 0xffffffe0000026cc
[ 0.000000] [<ffffffe0000006ec>] 0xffffffe0000006ec
[ 0.000000] [<ffffffe000000076>] 0xffffffe000000076
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@xxxxxxx
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."