From: Dickson Wu via B4 Relay <devnull+dickson.wu.certik.com@kernel.org>
To: stable@vger.kernel.org
Cc: Fan Wu <fanwu01@zju.edu.cn>,
Johan Hovold <johan+linaro@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
linux-usb@vger.kernel.org
Subject: [PATCH 6.6.y 3/3] usb: typec: qcom-pmic-typec: drain cc_debounce_dwork if port_start() fails
Date: Fri, 27 Nov 2026 20:47:03 +0000 [thread overview]
Message-ID: <20261127-typec-66b-v1-3-6fe3a0983e5e@certik.com> (raw)
In-Reply-To: <2026090807-unbalance-starlet-1c55@gregkh>
From: Fan Wu <fanwu01@zju.edu.cn>
commit c9273c83885835dbd1e8835d5665dfb8503d65e0 upstream.
cc_debounce_dwork can be queued before port_start() fails:
tcpm_register_port() runs first, and its state machine may invoke
set_cc() or start_toggling() from the TCPM worker. The error path then
calls tcpm_unregister_port(), whose worker flush may queue the delayed
work before devres frees pmic_typec_port.
Disable and drain the delayed work directly at port_start()'s error
exit. Do not use port_stop() for this path: its IRQs use IRQF_NO_AUTOEN
and are enabled only after a successful port_start().
This issue was found by an in-house static analysis tool.
Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
Cc: stable <stable@kernel.org> # v6.10+
Suggested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Assisted-by: Codex:gpt-5.6
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://patch.msgid.link/20260820135307.153773-3-fanwu01@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ adapted to 6.6.y: call the port's debounce shutdown helper ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
---
This reuses the helper from patch 2 at port_start()'s error exit.
The backport and the test runs were prepared with AI coding tools
(OpenAI Codex agents, with review by Claude). I went over the result
before signing off.
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
index f0e5e8ab06c0..8e6507ce895f 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
@@ -502,6 +502,9 @@ int qcom_pmic_typec_port_start(struct pmic_typec_port *pmic_typec_port,
enable_irq(pmic_typec_port->irq_data[i].irq);
done:
+ if (ret)
+ qcom_pmic_typec_port_disable_debounce(pmic_typec_port);
+
return ret;
}
--
2.43.0
prev parent reply other threads:[~2026-11-27 20:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2026090807-unbalance-starlet-1c55@gregkh>
2026-11-27 20:47 ` [PATCH 6.6.y 0/3] usb: typec: qcom-pmic-typec: fix late probe and debounce teardown Dickson Wu via B4 Relay
2026-11-27 20:59 ` sashiko-bot
2026-11-27 20:47 ` [PATCH 6.6.y 1/3] usb: typec: qcom-pmic: fix use-after-free on late probe errors Dickson Wu via B4 Relay
2026-11-27 20:47 ` [PATCH 6.6.y 2/3] usb: typec: qcom-pmic-typec: disable cc_debounce_dwork on stop Dickson Wu via B4 Relay
2026-11-27 20:47 ` Dickson Wu via B4 Relay [this message]
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=20261127-typec-66b-v1-3-6fe3a0983e5e@certik.com \
--to=devnull+dickson.wu.certik.com@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=dickson.wu@certik.com \
--cc=fanwu01@zju.edu.cn \
--cc=heikki.krogerus@linux.intel.com \
--cc=johan+linaro@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.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