Re: [PATCH 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure
From: Konrad Dybcio
Date: Thu Dec 03 2026 - 05:38:23 EST
On 12/3/26 9:28 AM, Lee Jones wrote:
> qcom_ipcc_setup_mbox() declares curr_ph on the stack without
> initialising it and unconditionally calls of_node_put(curr_ph.np)
> immediately after of_parse_phandle_with_args(), before checking whether
> the call succeeded. If of_parse_phandle_with_args() fails on the first
> iteration, of_node_put() dereferences an uninitialised stack pointer;
> on subsequent iterations it drops the reference to the previous node a
> second time.
>
> Skip the remainder of the loop iteration when
> of_parse_phandle_with_args() returns an error, and only release
> curr_ph.np on success.
>
> Fixes: e9d50e4b4d04 ("mailbox: qcom-ipcc: Dynamic alloc for channel arrangement")
> Closes: https://sashiko.dev/#/bug/linux-2052db5b-c6e1-4da3-aab4-7612dc67c78b
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
Konrad