From: Lee Jones <lee@kernel.org>
To: lee@kernel.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Huang Yiwei <quic_hyiwei@quicinc.com>,
Jassi Brar <jassisinghbrar@gmail.com>,
Kumar Gutta <vnkgutta@codeaurora.org>,
linux-arm-msm@vger.kernel.org,
Manivannan Sadhasivam <mani@kernel.org>
Subject: [PATCH 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure
Date: Thu, 3 Dec 2026 08:28:01 +0000 [thread overview]
Message-ID: <07e8f9f574705f164bcbe11e6842c8aec50242b9.1796286447.git.lee@kernel.org> (raw)
In-Reply-To: <cover.1796286447.git.lee@kernel.org>
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@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
Cc: Huang Yiwei <quic_hyiwei@quicinc.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Kumar Gutta <vnkgutta@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: Manivannan Sadhasivam <mani@kernel.org>
drivers/mailbox/qcom-ipcc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index bb54295e03ce..19fea341bd12 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -239,9 +239,12 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc,
for (j = 0; j < i; j++) {
ret = of_parse_phandle_with_args(client_dn, "mboxes",
"#mbox-cells", j, &curr_ph);
- of_node_put(curr_ph.np);
- if (!ret && curr_ph.np == controller_dn)
+ if (ret)
+ continue;
+
+ if (curr_ph.np == controller_dn)
ipcc->num_chans++;
+ of_node_put(curr_ph.np);
}
}
--
2.56.1.911.g883d8bcb20-goog
next prev parent reply other threads:[~2026-12-03 8:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:28 [PATCH 00/10] mailbox: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03 8:28 ` Lee Jones [this message]
2026-12-03 10:38 ` [PATCH 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure Konrad Dybcio
2026-12-03 8:28 ` [PATCH 02/10] mailbox: ti-msgmgr: Use unsigned IDs in ti_msgmgr_of_xlate() Lee Jones
2026-12-03 8:28 ` [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave Lee Jones
2026-12-03 14:32 ` Rahul Pathak
2026-12-03 15:05 ` Lee Jones
2026-12-03 8:28 ` [PATCH 04/10] mailbox: riscv-sbi-mpxy: Validate shmem bounds in message send helpers Lee Jones
2026-12-03 8:28 ` [PATCH 05/10] mailbox: bcm-pdc: Unregister mailbox controller before destroying DMA pools Lee Jones
2026-12-03 8:28 ` [PATCH 06/10] mailbox: qcom-ipcc: Remove IRQ domain via devm to avoid ISR use-after-free Lee Jones
2026-12-03 10:39 ` Konrad Dybcio
2026-12-03 8:28 ` [PATCH 07/10] mailbox: sun6i-msgbox: Free IRQ before disabling clock on teardown Lee Jones
2026-12-03 13:43 ` Chen-Yu Tsai
2026-12-03 8:28 ` [PATCH 08/10] mailbox: sun6i-msgbox: Synchronise IRQ during channel shutdown Lee Jones
2026-12-03 13:49 ` Chen-Yu Tsai
2026-12-03 8:28 ` [PATCH 09/10] mailbox: arm_mhu_db: Initialise channel registers before controller registration Lee Jones
2026-12-03 9:40 ` Sudeep Holla
2026-12-03 8:28 ` [PATCH 10/10] mailbox: ti-msgmgr: Return -EIO on queue error in ti_msgmgr_send_data() Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07e8f9f574705f164bcbe11e6842c8aec50242b9.1796286447.git.lee@kernel.org \
--to=lee@kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@kernel.org \
--cc=quic_hyiwei@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=vnkgutta@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®