mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
usb: chipidea: ci_hdrc_imx: fix potential error pointer dereference in probe
commitd4d2e5329aupstream. If the first call to devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0) fails with something other than -ENODEV then it leads to an error pointer dereference. For those errors we should just jump directly to the error handling. Fixes:8253a34bfa("usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle") Cc: stable <stable@vger.kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20211117074923.GF5237@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b70ff391de
commit
56fbab4937
@@ -425,7 +425,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
|||||||
data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0);
|
data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0);
|
||||||
if (IS_ERR(data->phy)) {
|
if (IS_ERR(data->phy)) {
|
||||||
ret = PTR_ERR(data->phy);
|
ret = PTR_ERR(data->phy);
|
||||||
if (ret == -ENODEV) {
|
if (ret != -ENODEV)
|
||||||
|
goto err_clk;
|
||||||
data->phy = devm_usb_get_phy_by_phandle(dev, "phys", 0);
|
data->phy = devm_usb_get_phy_by_phandle(dev, "phys", 0);
|
||||||
if (IS_ERR(data->phy)) {
|
if (IS_ERR(data->phy)) {
|
||||||
ret = PTR_ERR(data->phy);
|
ret = PTR_ERR(data->phy);
|
||||||
@@ -435,7 +436,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
|||||||
goto err_clk;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pdata.usb_phy = data->phy;
|
pdata.usb_phy = data->phy;
|
||||||
if (data->usbmisc_data)
|
if (data->usbmisc_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user