linux/drivers/usb/dwc3
Martin Blumenstingl 347052e3bf usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs
dwc3_meson_g12a_usb2_init_phy() crashes with NULL pointer on an SM1
board (which uses the same USB setup as G12A) dereference as reported
by the Kernel CI bot. This is because of the following call flow:
  dwc3_meson_g12a_probe
    priv->drvdata->setup_regmaps
      dwc3_meson_g12a_setup_regmaps
        priv->usb2_ports is still 0 so priv->u2p_regmap[i] will be NULL
    dwc3_meson_g12a_get_phys
      initializes priv->usb2_ports
    priv->drvdata->usb_init
      dwc3_meson_g12a_usb_init
        dwc3_meson_g12a_usb_init_glue
          dwc3_meson_g12a_usb2_init
            priv->drvdata->usb2_init_phy
              dwc3_meson_g12a_usb2_init_phy
                dereferences priv->u2p_regmap[i]

Call priv->drvdata->setup_regmaps only after dwc3_meson_g12a_get_phys so
priv->usb2_ports is initialized and the regmaps will be set up
correctly. This fixes the NULL dereference later on.

Fixes: 013af227f5 ("usb: dwc3: meson-g12a: handle the phy and glue registers separately")
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Acked-by: Felipe Balbi <balbi@kernel.org>
Acked-by: Neil Armstrong <narmstron@baylibre.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20200526202943.715220-3-martin.blumenstingl@googlemail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-29 12:21:26 +02:00
..
core.c usb: dwc3: Add support for DWC_usb32 IP 2020-05-25 11:09:40 +03:00
core.h usb: dwc3: gadget: Use SET_EP_PRIME for NoStream 2020-05-25 11:09:42 +03:00
debug.h usb: dwc3: gadget: Handle stream transfers 2020-05-25 11:09:42 +03:00
debugfs.c usb: dwc3: Get MDWIDTH for DWC_usb32 2020-05-25 11:09:41 +03:00
drd.c usb: dwc3: use true,false for dwc->otg_restart_host 2020-05-25 11:09:39 +03:00
dwc3-exynos.c usb: dwc3: exynos: Add support for Exynos5422 suspend clk 2020-03-15 11:08:27 +02:00
dwc3-haps.c
dwc3-keystone.c usb: dwc3: keystone: Turn on USB3 PHY before controller 2020-05-25 11:10:07 +03:00
dwc3-meson-g12a.c usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs 2020-05-29 12:21:26 +02:00
dwc3-of-simple.c usb: dwc3: of-simple: remove Amlogic GXL and AXG compatibles 2020-05-25 11:09:38 +03:00
dwc3-omap.c USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
dwc3-pci.c usb: dwc3: pci: Enable extcon driver for Intel Merrifield 2020-05-09 11:04:50 +03:00
dwc3-qcom.c usb: dwc3: qcom: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-03-15 11:32:56 +02:00
dwc3-st.c usb: dwc3: st: Add of_dev_put() in probe function 2019-08-28 13:04:58 +03:00
ep0.c usb: dwc3: gadget: Check END_TRANSFER completion 2020-01-15 10:39:23 +01:00
gadget.c USB: changes for v5.8 merge window 2020-05-25 13:28:20 +02:00
gadget.h USB: dwc3: Use the correct style for SPDX License Identifier 2020-05-05 10:58:49 +03:00
host.c usb: dwc3: Add support for DWC_usb32 IP 2020-05-25 11:09:40 +03:00
io.h USB: dwc3: Use the correct style for SPDX License Identifier 2020-05-05 10:58:49 +03:00
Kconfig usb: dwc3: select USB_ROLE_SWITCH 2020-05-09 11:05:09 +03:00
Makefile usb: dwc3: Add Amlogic G12A DWC3 glue 2019-05-03 09:13:47 +03:00
trace.c
trace.h USB: dwc3: Use the correct style for SPDX License Identifier 2020-05-05 10:58:49 +03:00
ulpi.c