* [PATCH] phy: tegra: xusb: Fix crash during pad power on/down
@ 2022-10-10 13:51 Jon Hunter
2022-10-17 5:37 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2022-10-10 13:51 UTC (permalink / raw)
To: JC Kuo, Kishon Vijay Abraham I, Vinod Koul, Thierry Reding
Cc: linux-phy, linux-tegra, Jim Lin, Jon Hunter
Commit a88520bfc0ec ("usb: gadget: tegra: Reduce pad power") added calls
to tegra_phy_xusb_utmi_pad_power_on/down in the Tegra XUDC driver to
control the pad power. This change is causing a kernel panic when
powering down the pads on entering suspend with the Jetson TX2 platform.
The panic occurs because the 'xudc->curr_utmi_phy' is not configured on
this platform and we do not check to see if the pointer is valid before
attempting to deference the pointer. Fix this by checking to see if the
'phy' pointer passed to tegra_phy_xusb_utmi_pad_power_on/down is valid.
Fixes: a88520bfc0ec ("usb: gadget: tegra: Reduce pad power")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
drivers/phy/tegra/xusb.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 95091876c422..dce45fbbd699 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -1461,8 +1461,14 @@ EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset);
void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy)
{
- struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
- struct tegra_xusb_padctl *padctl = lane->pad->padctl;
+ struct tegra_xusb_lane *lane;
+ struct tegra_xusb_padctl *padctl;
+
+ if (!phy)
+ return;
+
+ lane = phy_get_drvdata(phy);
+ padctl = lane->pad->padctl;
if (padctl->soc->ops->utmi_pad_power_on)
padctl->soc->ops->utmi_pad_power_on(phy);
@@ -1471,8 +1477,14 @@ EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_pad_power_on);
void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy)
{
- struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
- struct tegra_xusb_padctl *padctl = lane->pad->padctl;
+ struct tegra_xusb_lane *lane;
+ struct tegra_xusb_padctl *padctl;
+
+ if (!phy)
+ return;
+
+ lane = phy_get_drvdata(phy);
+ padctl = lane->pad->padctl;
if (padctl->soc->ops->utmi_pad_power_down)
padctl->soc->ops->utmi_pad_power_down(phy);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] phy: tegra: xusb: Fix crash during pad power on/down
2022-10-10 13:51 [PATCH] phy: tegra: xusb: Fix crash during pad power on/down Jon Hunter
@ 2022-10-17 5:37 ` Vinod Koul
2022-11-07 21:27 ` Jon Hunter
0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2022-10-17 5:37 UTC (permalink / raw)
To: Jon Hunter
Cc: JC Kuo, Kishon Vijay Abraham I, Thierry Reding, linux-phy,
linux-tegra, Jim Lin
On 10-10-22, 14:51, Jon Hunter wrote:
> Commit a88520bfc0ec ("usb: gadget: tegra: Reduce pad power") added calls
> to tegra_phy_xusb_utmi_pad_power_on/down in the Tegra XUDC driver to
> control the pad power. This change is causing a kernel panic when
> powering down the pads on entering suspend with the Jetson TX2 platform.
> The panic occurs because the 'xudc->curr_utmi_phy' is not configured on
> this platform and we do not check to see if the pointer is valid before
> attempting to deference the pointer. Fix this by checking to see if the
> 'phy' pointer passed to tegra_phy_xusb_utmi_pad_power_on/down is valid.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] phy: tegra: xusb: Fix crash during pad power on/down
2022-10-17 5:37 ` Vinod Koul
@ 2022-11-07 21:27 ` Jon Hunter
2022-11-10 7:09 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2022-11-07 21:27 UTC (permalink / raw)
To: Vinod Koul
Cc: JC Kuo, Kishon Vijay Abraham I, Thierry Reding, linux-phy,
linux-tegra, Jim Lin
Hi Vinod,
On 17/10/2022 06:37, Vinod Koul wrote:
> On 10-10-22, 14:51, Jon Hunter wrote:
>> Commit a88520bfc0ec ("usb: gadget: tegra: Reduce pad power") added calls
>> to tegra_phy_xusb_utmi_pad_power_on/down in the Tegra XUDC driver to
>> control the pad power. This change is causing a kernel panic when
>> powering down the pads on entering suspend with the Jetson TX2 platform.
>> The panic occurs because the 'xudc->curr_utmi_phy' is not configured on
>> this platform and we do not check to see if the pointer is valid before
>> attempting to deference the pointer. Fix this by checking to see if the
>> 'phy' pointer passed to tegra_phy_xusb_utmi_pad_power_on/down is valid.
>
> Applied, thanks
>
We need this fix for Linux v6.1. The crash is still seen as of v6.1-rc3.
Thanks
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] phy: tegra: xusb: Fix crash during pad power on/down
2022-11-07 21:27 ` Jon Hunter
@ 2022-11-10 7:09 ` Vinod Koul
0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-11-10 7:09 UTC (permalink / raw)
To: Jon Hunter
Cc: JC Kuo, Kishon Vijay Abraham I, Thierry Reding, linux-phy,
linux-tegra, Jim Lin
On 07-11-22, 21:27, Jon Hunter wrote:
> Hi Vinod,
>
> On 17/10/2022 06:37, Vinod Koul wrote:
> > On 10-10-22, 14:51, Jon Hunter wrote:
> > > Commit a88520bfc0ec ("usb: gadget: tegra: Reduce pad power") added calls
> > > to tegra_phy_xusb_utmi_pad_power_on/down in the Tegra XUDC driver to
> > > control the pad power. This change is causing a kernel panic when
> > > powering down the pads on entering suspend with the Jetson TX2 platform.
> > > The panic occurs because the 'xudc->curr_utmi_phy' is not configured on
> > > this platform and we do not check to see if the pointer is valid before
> > > attempting to deference the pointer. Fix this by checking to see if the
> > > 'phy' pointer passed to tegra_phy_xusb_utmi_pad_power_on/down is valid.
> >
> > Applied, thanks
> >
>
> We need this fix for Linux v6.1. The crash is still seen as of v6.1-rc3.
This is in phy/fixes so should be in v6.1 or in linus's tree shortly
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-10 7:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10 13:51 [PATCH] phy: tegra: xusb: Fix crash during pad power on/down Jon Hunter
2022-10-17 5:37 ` Vinod Koul
2022-11-07 21:27 ` Jon Hunter
2022-11-10 7:09 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox