* [PATCH v3] phy: tegra: xusb: Clear the driver reference in usb-phy dev
@ 2023-06-09 6:29 Haotien Hsu
2023-06-20 13:51 ` Jon Hunter
2023-06-21 12:01 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Haotien Hsu @ 2023-06-09 6:29 UTC (permalink / raw)
To: JC Kuo, Vinod Koul, Kishon Vijay Abraham I, Thierry Reding,
Jonathan Hunter, Philipp Zabel, linux-phy, linux-tegra,
linux-kernel
Cc: Wayne Chang, EJ Hsu, Haotien Hsu
From: EJ Hsu <ejh@nvidia.com>
For the dual-role port, it will assign the phy dev to usb-phy dev and
use the port dev driver as the dev driver of usb-phy.
When we try to destroy the port dev, it will destroy its dev driver
as well. But we did not remove the reference from usb-phy dev. This
might cause the use-after-free issue in KASAN.
Fixes: e8f7d2f409a1 ("phy: tegra: xusb: Add usb-phy support")
Cc: stable@vger.kernel.org
Signed-off-by: EJ Hsu <ejh@nvidia.com>
Signed-off-by: Haotien Hsu <haotienh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
---
V1 -> V2: Remove extra movements to clarify the change
V2 -> V3: Update patch title
---
drivers/phy/tegra/xusb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 78045bd6c214..26b66a668f3b 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -568,6 +568,7 @@ static void tegra_xusb_port_unregister(struct tegra_xusb_port *port)
usb_role_switch_unregister(port->usb_role_sw);
cancel_work_sync(&port->usb_phy_work);
usb_remove_phy(&port->usb_phy);
+ port->usb_phy.dev->driver = NULL;
}
if (port->ops->remove)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] phy: tegra: xusb: Clear the driver reference in usb-phy dev
2023-06-09 6:29 [PATCH v3] phy: tegra: xusb: Clear the driver reference in usb-phy dev Haotien Hsu
@ 2023-06-20 13:51 ` Jon Hunter
2023-06-21 12:01 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2023-06-20 13:51 UTC (permalink / raw)
To: Haotien Hsu, Vinod Koul
Cc: Wayne Chang, EJ Hsu, JC Kuo, Kishon Vijay Abraham I,
Thierry Reding, linux-phy, linux-kernel, linux-tegra,
Philipp Zabel
Hi Vinod,
On 09/06/2023 07:29, Haotien Hsu wrote:
> From: EJ Hsu <ejh@nvidia.com>
>
> For the dual-role port, it will assign the phy dev to usb-phy dev and
> use the port dev driver as the dev driver of usb-phy.
>
> When we try to destroy the port dev, it will destroy its dev driver
> as well. But we did not remove the reference from usb-phy dev. This
> might cause the use-after-free issue in KASAN.
>
> Fixes: e8f7d2f409a1 ("phy: tegra: xusb: Add usb-phy support")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: EJ Hsu <ejh@nvidia.com>
> Signed-off-by: Haotien Hsu <haotienh@nvidia.com>
> Acked-by: Thierry Reding <treding@nvidia.com>
> Acked-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> V1 -> V2: Remove extra movements to clarify the change
> V2 -> V3: Update patch title
> ---
> drivers/phy/tegra/xusb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> index 78045bd6c214..26b66a668f3b 100644
> --- a/drivers/phy/tegra/xusb.c
> +++ b/drivers/phy/tegra/xusb.c
> @@ -568,6 +568,7 @@ static void tegra_xusb_port_unregister(struct tegra_xusb_port *port)
> usb_role_switch_unregister(port->usb_role_sw);
> cancel_work_sync(&port->usb_phy_work);
> usb_remove_phy(&port->usb_phy);
> + port->usb_phy.dev->driver = NULL;
> }
>
> if (port->ops->remove)
OK to pick this up now?
Thanks
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] phy: tegra: xusb: Clear the driver reference in usb-phy dev
2023-06-09 6:29 [PATCH v3] phy: tegra: xusb: Clear the driver reference in usb-phy dev Haotien Hsu
2023-06-20 13:51 ` Jon Hunter
@ 2023-06-21 12:01 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-06-21 12:01 UTC (permalink / raw)
To: Haotien Hsu
Cc: JC Kuo, Kishon Vijay Abraham I, Thierry Reding, Jonathan Hunter,
Philipp Zabel, linux-phy, linux-tegra, linux-kernel, Wayne Chang,
EJ Hsu
On 09-06-23, 14:29, Haotien Hsu wrote:
> From: EJ Hsu <ejh@nvidia.com>
>
> For the dual-role port, it will assign the phy dev to usb-phy dev and
> use the port dev driver as the dev driver of usb-phy.
>
> When we try to destroy the port dev, it will destroy its dev driver
> as well. But we did not remove the reference from usb-phy dev. This
> might cause the use-after-free issue in KASAN.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-21 12:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 6:29 [PATCH v3] phy: tegra: xusb: Clear the driver reference in usb-phy dev Haotien Hsu
2023-06-20 13:51 ` Jon Hunter
2023-06-21 12:01 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).