[ldv-project] (no subject)
Andy Shevchenko
andy.shevchenko at gmail.com
Wed Aug 11 23:36:27 MSK 2021
On Wednesday, August 11, 2021, Nadezda Lutovinova <lutovinova at ispras.ru>
wrote:
> Date: Fri, 30 Jul 2021 18:20:00 +0300
> Subject: [PATCH] usb: musb: musb_dsps: Change function call order in
> dsps_probe()
Something wrong with email formatting.
>
> If IRQ occurs between calling dsps_setup_optional_vbus_irq()
> and dsps_create_musb_pdev(), then null pointer dereference occurs
> since glue->musb wasn't initialized yet.
>
> The patch puts initializing of neccesery data before registration
> of the interrupt handler.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Nadezda Lutovinova <lutovinova at ispras.ru>
> ---
> drivers/usb/musb/musb_dsps.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 5892f3ce0cdc..ce9fc46c9266 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -890,23 +890,22 @@ static int dsps_probe(struct platform_device *pdev)
> if (!glue->usbss_base)
> return -ENXIO;
>
> - if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) {
> - ret = dsps_setup_optional_vbus_irq(pdev, glue);
> - if (ret)
> - goto err_iounmap;
> - }
> -
> platform_set_drvdata(pdev, glue);
> pm_runtime_enable(&pdev->dev);
> ret = dsps_create_musb_pdev(glue, pdev);
> if (ret)
> goto err;
>
> + if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) {
> + ret = dsps_setup_optional_vbus_irq(pdev, glue);
> + if (ret)
> + goto err;
> + }
> +
> return 0;
>
> err:
> pm_runtime_disable(&pdev->dev);
> -err_iounmap:
> iounmap(glue->usbss_base);
> return ret;
> }
> --
> 2.17.1
>
>
--
With Best Regards,
Andy Shevchenko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxtesting.org/pipermail/ldv-project/attachments/20210811/6ace8743/attachment.html>
More information about the ldv-project
mailing list