* [PATCH] usb: xhci-dwc3: Fix usage of bulk PHY API
@ 2020-05-30 8:37 Samuel Holland
2020-05-30 9:34 ` Aw: " Frank Wunderlich
2020-06-01 1:32 ` Chunfeng Yun
0 siblings, 2 replies; 3+ messages in thread
From: Samuel Holland @ 2020-05-30 8:37 UTC (permalink / raw)
To: u-boot
The PHY consumer is responsible for allocating the struct phy_bulk.
During conversion to the bulk API, the contents of the struct were
replaced by a pointer instead of the struct itself. This leads to a null
pointer dereference in generic_phy_get_bulk() when setting bulk->phys.
Fixes: 6dfb8a8052ee ("usb: dwc3: use the phy bulk API to get phys")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/usb/host/xhci-dwc3.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index 563db1a426..9b22f271a7 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -19,7 +19,7 @@
#include <linux/usb/otg.h>
struct xhci_dwc3_platdata {
- struct phy_bulk *usb_phys;
+ struct phy_bulk usb_phys;
};
void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
@@ -124,7 +124,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
hcor = (struct xhci_hcor *)((uintptr_t)hccr +
HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
- ret = dwc3_setup_phy(dev, plat->usb_phys);
+ ret = dwc3_setup_phy(dev, &plat->usb_phys);
if (ret && (ret != -ENOTSUPP))
return ret;
@@ -167,7 +167,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
{
struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
- dwc3_shutdown_phy(dev, plat->usb_phys);
+ dwc3_shutdown_phy(dev, &plat->usb_phys);
return xhci_deregister(dev);
}
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Aw: [PATCH] usb: xhci-dwc3: Fix usage of bulk PHY API
2020-05-30 8:37 [PATCH] usb: xhci-dwc3: Fix usage of bulk PHY API Samuel Holland
@ 2020-05-30 9:34 ` Frank Wunderlich
2020-06-01 1:32 ` Chunfeng Yun
1 sibling, 0 replies; 3+ messages in thread
From: Frank Wunderlich @ 2020-05-30 9:34 UTC (permalink / raw)
To: u-boot
Hi,
my mistake is already fixed and merged by commit "usb: dwc3: fix NULL pointer issue" by original author of xhci/bulk-api
https://gitlab.denx.de/u-boot/u-boot/-/commit/58221d7e876c2f75ae7696aad853d81ccd76fb7a
regards Frank
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] usb: xhci-dwc3: Fix usage of bulk PHY API
2020-05-30 8:37 [PATCH] usb: xhci-dwc3: Fix usage of bulk PHY API Samuel Holland
2020-05-30 9:34 ` Aw: " Frank Wunderlich
@ 2020-06-01 1:32 ` Chunfeng Yun
1 sibling, 0 replies; 3+ messages in thread
From: Chunfeng Yun @ 2020-06-01 1:32 UTC (permalink / raw)
To: u-boot
Hi Samuel,
This bug was fixed up two weeks ago,
https://patchwork.ozlabs.org/project/uboot/patch/1589435712-8795-1-git-send-email-chunfeng.yun at mediatek.com/
thanks
On Sat, 2020-05-30 at 03:37 -0500, Samuel Holland wrote:
> The PHY consumer is responsible for allocating the struct phy_bulk.
> During conversion to the bulk API, the contents of the struct were
> replaced by a pointer instead of the struct itself. This leads to a null
> pointer dereference in generic_phy_get_bulk() when setting bulk->phys.
>
> Fixes: 6dfb8a8052ee ("usb: dwc3: use the phy bulk API to get phys")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> drivers/usb/host/xhci-dwc3.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
> index 563db1a426..9b22f271a7 100644
> --- a/drivers/usb/host/xhci-dwc3.c
> +++ b/drivers/usb/host/xhci-dwc3.c
> @@ -19,7 +19,7 @@
> #include <linux/usb/otg.h>
>
> struct xhci_dwc3_platdata {
> - struct phy_bulk *usb_phys;
> + struct phy_bulk usb_phys;
> };
>
> void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
> @@ -124,7 +124,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
> hcor = (struct xhci_hcor *)((uintptr_t)hccr +
> HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
>
> - ret = dwc3_setup_phy(dev, plat->usb_phys);
> + ret = dwc3_setup_phy(dev, &plat->usb_phys);
> if (ret && (ret != -ENOTSUPP))
> return ret;
>
> @@ -167,7 +167,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
> {
> struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
>
> - dwc3_shutdown_phy(dev, plat->usb_phys);
> + dwc3_shutdown_phy(dev, &plat->usb_phys);
>
> return xhci_deregister(dev);
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-01 1:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 8:37 [PATCH] usb: xhci-dwc3: Fix usage of bulk PHY API Samuel Holland
2020-05-30 9:34 ` Aw: " Frank Wunderlich
2020-06-01 1:32 ` Chunfeng Yun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.