From: sashiko-bot@kernel.org
To: "Elson Serrao" <elson.serrao@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v6 3/9] usb: misc: qcom_eud: add per-path High-Speed PHY control
Date: Tue, 11 Aug 2026 21:56:58 +0000 [thread overview]
Message-ID: <20260811215659.676F81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811213610.2956147-4-elson.serrao@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Lack of locking in sysfs handlers allows concurrent execution and TOCTOU races, leading to unbalanced PHY operations and driver state corruption.
--
--- Patch [3]: [PATCH v6 3/9] usb: misc: qcom_eud: add per-path High-Speed PHY control ---
commit 0126e533bbae398f1f9f6831389bcefdb1ad1252
Author: Elson Serrao <elson.serrao@oss.qualcomm.com>
usb: misc: qcom_eud: add per-path High-Speed PHY control
This patch restructures the EUD driver to implement per-path PHY management,
powering the appropriate PHY based on the selected UTMI path. This ensures
the PHY is explicitly initialized and powered when EUD is enabled.
> diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
> index 25a6a8f110ec8..03d1c200658c8 100644
> --- a/drivers/usb/misc/qcom_eud.c
> +++ b/drivers/usb/misc/qcom_eud.c
[ ... ]
> @@ -130,6 +192,10 @@ static ssize_t port_store(struct device *dev, struct device_attribute *attr,
> if (port < 0)
> return port;
>
> + /* Check if the corresponding path is available */
> + if (!chip->paths[port])
> + return -EOPNOTSUPP;
> +
> /* Port selection must be done before enabling EUD */
> if (chip->enabled)
> return -EBUSY;
[Severity: High]
Is there a lock missing here in port_store() to synchronize with enable_store()?
Looking at enable_store(), it uses guard(mutex)(&chip->state_lock) before
checking chip->enabled, but port_store() appears to check chip->enabled and
mutate chip->port_idx without holding this lock.
Could this allow a race where port_store() changes chip->port_idx while
enable_store() is midway through enablement?
For example, if port_store() executes right after enable_eud() initializes
the PHY in enable_store() but before chip->enabled is set to true:
Thread 1 in enable_store():
guard(mutex)(&chip->state_lock);
enable_eud(chip);
Thread 2 in port_store():
if (chip->enabled)
return -EBUSY;
chip->port_idx = port;
Thread 1 in enable_store():
chip->enabled = true;
Would this cause subsequent disablements to read the new port_idx in
eud_phy_disable(), leaving the original PHY powered on and attempting to
power off the new PHY?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260811213610.2956147-1-elson.serrao@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-08-11 21:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 21:36 [PATCH v6 0/9] Improve Qualcomm EUD driver and platform support Elson Serrao
2026-08-11 21:36 ` [PATCH v6 1/9] dt-bindings: soc: qcom: eud: Add per-path child nodes for UTMI routing Elson Serrao
2026-08-11 21:50 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 2/9] usb: misc: qcom_eud: add sysfs attribute for port selection Elson Serrao
2026-08-11 21:54 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 3/9] usb: misc: qcom_eud: add per-path High-Speed PHY control Elson Serrao
2026-08-11 21:56 ` sashiko-bot [this message]
2026-08-11 21:36 ` [PATCH v6 4/9] usb: misc: qcom_eud: add per-path role switch support Elson Serrao
2026-08-11 21:57 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 5/9] usb: misc: qcom_eud: improve enable_store API Elson Serrao
2026-08-11 21:56 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 6/9] usb: misc: qcom_eud: add role-based EUD control Elson Serrao
2026-08-11 21:54 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 7/9] usb: misc: qcom_eud: fix virtual attach/detach event handling Elson Serrao
2026-08-11 22:00 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 8/9] arm64: dts: qcom: kodiak: Describe EUD UTMI path using child node Elson Serrao
2026-08-11 22:05 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 9/9] arm64: dts: qcom: Map USB connector to EUD on Kodiak boards Elson Serrao
2026-08-11 22:06 ` sashiko-bot
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=20260811215659.676F81F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=elson.serrao@oss.qualcomm.com \
--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