Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Akash Kumar" <akash.kumar@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/3] usb: ucsi: ccg: Add support for CYPD6129 (CCG6)
Date: Wed, 20 May 2026 10:27:36 +0000	[thread overview]
Message-ID: <20260520102736.7FF0E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260520093902.2064730-4-akash.kumar@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incorrect teardown order in ucsi_ccg_remove allows the IRQ handler to execute after ucsi_unregister and ucsi_destroy have freed the ucsi instance and its connectors, leading to a use-after-free vulnerability.
--

commit d51e27a1b01686843b28a09a37b6e7b3a61e453b
Author: Akash Kumar <akash.kumar@oss.qualcomm.com>

usb: ucsi: ccg: Add support for CYPD6129 (CCG6)

This commit adds "cypress,cypd6129" to the UCSI CCG driver match table.
This allows the driver to bind to CCG6-based platforms using this
controller.

> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> index 199799b319c2a..0695ce348135c 100644
> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> @@ -1520,6 +1520,7 @@ static void ucsi_ccg_remove(struct i2c_client *client)

[Severity: High]
This is a pre-existing issue, but does the teardown order in ucsi_ccg_remove()
cause a use-after-free of the ucsi instance and its connectors?

Looking at ucsi_ccg_remove():

	ucsi_unregister(uc->ucsi);
	ucsi_destroy(uc->ucsi);
	free_irq(uc->irq, uc);

Because free_irq() is called after ucsi_unregister() and ucsi_destroy(), an
interrupt could fire during the teardown process.

If this happens, the IRQ handler would execute and call ucsi_notify_common(),
which dereferences the already-freed uc->ucsi pointer and accesses the freed
ucsi->connector array.

Should free_irq() be moved before ucsi_unregister() so that any pending IRQ
handlers complete and no new ones are scheduled?

>  
>  static const struct of_device_id ucsi_ccg_of_match_table[] = {
>  		{ .compatible = "cypress,cypd4226", },
> +		{ .compatible = "cypress,cypd6129", },
>  		{ /* sentinel */ }
>  };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260520093902.2064730-1-akash.kumar@oss.qualcomm.com?part=3

  parent reply	other threads:[~2026-05-20 10:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20  9:37 [PATCH 0/3] Add Cypress CYPD6129 UCSI support for monza SOM USB0 DRD Akash Kumar
2026-05-20  9:37 ` [PATCH 1/3] dt-bindings: usb: typec: Add Cypress CYPD6129 UCSI controller compatible Akash Kumar
2026-05-20  9:50   ` sashiko-bot
2026-05-20 10:01   ` Dmitry Baryshkov
2026-05-20 10:06   ` Dmitry Baryshkov
2026-05-20 11:21   ` Krzysztof Kozlowski
2026-05-20 11:57   ` Rob Herring (Arm)
2026-05-20  9:37 ` [PATCH 2/3] arm64: dts: qcom: monaco-monza-som: Enable USB0 DRD mode Akash Kumar
2026-05-20 10:05   ` Dmitry Baryshkov
2026-05-20 10:08   ` Dmitry Baryshkov
2026-05-20 11:15   ` Konrad Dybcio
2026-05-20 11:22   ` Krzysztof Kozlowski
2026-05-20  9:37 ` [PATCH 3/3] usb: ucsi: ccg: Add support for CYPD6129 (CCG6) Akash Kumar
2026-05-20 10:07   ` Dmitry Baryshkov
2026-05-20 10:27   ` sashiko-bot [this message]
2026-05-20 11:20   ` Krzysztof Kozlowski
2026-05-20 11:22 ` [PATCH 0/3] Add Cypress CYPD6129 UCSI support for monza SOM USB0 DRD Krzysztof Kozlowski

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=20260520102736.7FF0E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akash.kumar@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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