linux-stable/drivers/usb
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
..
atm USB: atm: Use the correct style for SPDX License Identifier 2020-03-17 20:03:28 +01:00
c67x00 USB: c67x00: Use the correct style for SPDX License Identifier 2020-03-17 20:03:28 +01:00
cdns3 USB: changes for v5.8 merge window 2020-05-25 13:28:20 +02:00
chipidea - Some improvments for ci_hdrc_usb2.c 2020-05-26 10:27:14 +02:00
class CDC-ACM: heed quirk also in error handling 2020-05-27 10:25:40 +02:00
common usb: common: usb-conn-gpio: Don't log an error on probe deferral 2019-12-10 11:41:20 +01:00
core Merge 5.7-rc6 into usb-next 2020-05-18 07:55:55 +02:00
dwc2 usb: dwc2: Update Core Reset programming flow. 2020-05-25 11:09:44 +03:00
dwc3 usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs 2020-05-29 12:21:26 +02:00
early Merge 5.7-rc3 into usb-next 2020-04-27 09:32:30 +02:00
gadget USB: changes for v5.8 merge window 2020-05-25 13:28:20 +02:00
host USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe() 2020-05-19 15:12:21 +02:00
image Merge 5.4-rc3 into usb-next 2019-10-14 07:09:59 +02:00
isp1760 USB: isp1760: Use the correct style for SPDX License Identifier 2020-04-16 14:32:47 +02:00
misc Merge 5.7-rc3 into usb-next 2020-04-27 09:32:30 +02:00
mon USB: mon: Use scnprintf() for avoiding potential buffer overflow 2020-03-12 09:49:28 +01:00
mtu3 USB: mtu3: Use the correct style for SPDX License Identifier 2020-05-25 11:09:37 +03:00
musb usb: musb: Fix runtime PM imbalance on error 2020-05-25 13:36:31 +02:00
phy Merge 5.7-rc6 into usb-next 2020-05-18 07:55:55 +02:00
renesas_usbhs usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-05-25 11:09:38 +03:00
roles usb: roles: Switch on role-switch uevent reporting 2020-05-13 14:20:49 +02:00
serial USB-serial fixes for 5.8-rc1 2020-05-29 10:32:04 +02:00
storage sierra-ms: do not call scsi_get_host_dev() 2020-05-13 14:20:00 +02:00
typec usb: typec: Ensure USB_ROLE_SWITCH is set as a dependency for tps6598x 2020-05-21 09:36:42 +02:00
usbip usbip: Fix error path of vhci_recv_ret_submit() 2019-12-17 16:36:33 +01:00
Kconfig
Makefile
usb-skeleton.c