usb: common: ulpi: Fix crash in ulpi_match()
Subsystems (3)
Jon Hunter
maintainerPATCH 1/1 usb: common: ulpi: Fix crash in ulpi_match()
Commit 7495af930835 ("ARM: multi_v7_defconfig: Enable drivers for DragonBoard 410c") enables the CONFIG_PHY_QCOM_USB_HS for the ARM multi_v7_defconfig. Enabling this Kconfig is causing the kernel to crash on the Tegra20 Ventana platform in the ulpi_match() function.
The Qualcomm USB HS PHY driver that is enabled by CONFIG_PHY_QCOM_USB_HS, registers a ulpi_driver but this driver does not provide an 'id_table', so when ulpi_match() is called on the Tegra20 Ventana platform, it crashes when attempting to deference the id_table pointer which is not valid. The Qualcomm USB HS PHY driver uses device-tree for matching the ULPI driver with the device and so fix this crash by using device-tree for matching if the id_table is not valid.
--- drivers/usb/common/ulpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/common/ulpi.c +5 -2
@@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)struct ulpi *ulpi =to_ulpi_dev (dev);const struct ulpi_device_id *id; -/* Some ULPI devices don't have a vendor id so rely on OF match */ -if (ulpi->id.vendor ==0 ) +/* +* Some ULPI devices don't have a vendor id +* or provide an id_table so rely on OF match. +*/ +if (ulpi->id.vendor ==0 || !drv->id_table)return of_driver_match_device (dev, driver);for (id = drv->id_table; id->vendor; id++)
Signature · 1 line
2.25.1
Heikki Krogerus
maintainerHi Jon,
Quoted 13 lines · Jon Hunter
Commit
7495af930835("ARM:multi_v7_defconfig: Enable drivers for DragonBoard 410c") enables theCONFIG_PHY_QCOM_USB_HSfor the ARMmulti_v7_defconfig. Enabling thisKconfigis causing the kernel to crash on the Tegra20 Ventana platform in theulpi_match()function.The Qualcomm USB HS PHY driver that is enabled by
CONFIG_PHY_QCOM_USB_HS, registers aulpi_driverbut this driver does not provide an 'id_table', so whenulpi_match()is called on the Tegra20 Ventana platform, it crashes when attempting to deference theid_tablepointer which is not valid. The Qualcomm USB HS PHY driver uses device-tree for matching the ULPI driver with the device and so fix this crash by using device-tree for matching if theid_tableis not valid.
Quoted 1 line
Signed-off-by Jon Hunter <[email protected]>
So is this fixing commit 7495af930835, or perhaps commit ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT")?
I would assume ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT"). Please include the appropriate Fixes tag.
Quoted 24 lines
--- drivers/usb/common/ulpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/usb/common/ulpi.c +5
-2@@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)struct ulpi *ulpi =to_ulpi_dev (dev);const struct ulpi_device_id *id; -/* Some ULPI devices don't have a vendor id so rely on OF match */ -if (ulpi->id.vendor ==0 ) +/* +* Some ULPI devices don't have a vendor id +* or provide an id_table so rely on OF match. +*/ +if (ulpi->id.vendor ==0 || !drv->id_table)return of_driver_match_device (dev, driver);for (id = drv->id_table; id->vendor; id++)Signature · 1 line
2.25.1
thanks,
Signature · 1 line
heikki
Jon Hunter
maintainerHi Heikki,
Quoted 16 lines · Heikki Krogerus
Hi Jon,
Quoted 13 lines · Jon Hunter
Commit
7495af930835("ARM:multi_v7_defconfig: Enable drivers for DragonBoard 410c") enables theCONFIG_PHY_QCOM_USB_HSfor the ARMmulti_v7_defconfig. Enabling thisKconfigis causing the kernel to crash on the Tegra20 Ventana platform in theulpi_match()function.The Qualcomm USB HS PHY driver that is enabled by
CONFIG_PHY_QCOM_USB_HS, registers aulpi_driverbut this driver does not provide an 'id_table', so whenulpi_match()is called on the Tegra20 Ventana platform, it crashes when attempting to deference theid_tablepointer which is not valid. The Qualcomm USB HS PHY driver uses device-tree for matching the ULPI driver with the device and so fix this crash by using device-tree for matching if theid_tableis not valid.
Quoted 7 lines
Quoted 1 line
Signed-off-by Jon Hunter <[email protected]>So is this fixing commit
7495af930835, or perhaps commitef6a7bcfb01c("usb: ulpi: Support device discovery via DT")?I would assume
ef6a7bcfb01c("usb: ulpi: Support device discovery via DT"). Please include the appropriate Fixes tag.
Yes that does sound appropriate. I have added and sent an update.
Cheers
Jon
Signature · 1 line
nvpublic