From: sashiko-bot@kernel.org
To: "Rustam Adilov" <adilov@disroot.org>,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org,
neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v9 5/6] phy: realtek: usb2: add support for RTL9607C USB2 PHY
Date: Fri, 16 Oct 2026 18:17:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-174762@kernel.org> (raw)
In-Reply-To: <20261016180314.31760-6-adilov@disroot.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] phy: realtek: missing of_iomap() check leads to NULL dereference
--
commit 69e22da529f3cad44ca97c0c6f0a80e03f43ad7e
Author: Rustam Adilov <adilov@disroot.org>
phy: realtek: usb2: add support for RTL9607C USB2 PHY
This commit adds support for the USB2 PHY on RTL9607C series SoCs. It
includes new macros, configuration structures, big-endian access functions,
and logic to clear a force host disconnect bit during initialization.
> diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c
> index 2ddad7be73534..64076938c821d 100644
> --- a/drivers/phy/realtek/phy-rtk-usb2.c
> +++ b/drivers/phy/realtek/phy-rtk-usb2.c
[ ... ]
> @@ -600,6 +617,23 @@ static int do_rtk_phy_init(struct rtk_phy *rtk_phy, int index)
> goto do_toggle;
> }
>
> + if (phy_cfg->force_host_disconnect) {
> + const struct phy_reg_desc *reg_desc = phy_reg->desc;
> + void __iomem *vstatus = phy_reg->reg_wrap_vstatus;
> + u32 temp;
> +
> + temp = reg_desc->read(vstatus + PHY_9607_FORCE_DISCONNECT_REG);
[Severity: High]
Can this result in a NULL pointer dereference?
If of_iomap() fails to map device memory, it returns NULL which is stored
without validation:
drivers/phy/realtek/phy-rtk-usb2.c:parse_phy_data() {
...
phy_parameter->phy_reg.reg_wrap_vstatus = of_iomap(np, 0);
...
}
This new code in do_rtk_phy_init() relies on this pointer by dereferencing
vstatus via the read function. Does this need an error check during the
initial mapping or before this dereference?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016180314.31760-1-adilov@disroot.org?part=5
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-10-16 18:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 18:03 [PATCH v9 0/6] phy: realtek: usb2: support for RTL9607C USB2 PHY Rustam Adilov
2026-10-16 18:03 ` [PATCH v9 1/6] phy: realtek: usb2: introduce phy_reg_desc struct to the driver Rustam Adilov
2026-10-16 18:15 ` sashiko-bot
2026-10-16 18:35 ` Rustam Adilov
2026-10-16 18:03 ` [PATCH v9 2/6] phy: realtek: usb2: introduce read and write functions to phy_reg_desc struct Rustam Adilov
2026-10-16 18:15 ` sashiko-bot
2026-10-16 18:03 ` [PATCH v9 3/6] dt-bindings: phy: realtek,usb2phy: extend for resets and RTL9607C support Rustam Adilov
2026-10-16 18:03 ` [PATCH v9 4/6] phy: realtek: usb2: introduce reset controller struct Rustam Adilov
2026-10-16 18:15 ` sashiko-bot
2026-10-16 18:31 ` Rustam Adilov
2026-10-16 18:03 ` [PATCH v9 5/6] phy: realtek: usb2: add support for RTL9607C USB2 PHY Rustam Adilov
2026-10-16 18:17 ` sashiko-bot [this message]
2026-10-16 18:03 ` [PATCH v9 6/6] phy: realtek: Make configs available for MACH_REALTEK_RTL Rustam Adilov
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=sashiko-outbox-174762@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=adilov@disroot.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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