<br><br>On Wednesday, August 11, 2021, Nadezda Lutovinova <<a href="mailto:lutovinova@ispras.ru">lutovinova@ispras.ru</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Date: Fri, 30 Jul 2021 18:20:00 +0300<br>
Subject: [PATCH] usb: musb: musb_dsps: Change function call order in<br>
dsps_probe()</blockquote><div><br></div><div><br></div><div>Something wrong with email formatting.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If IRQ occurs between calling dsps_setup_optional_vbus_irq()<br>
and dsps_create_musb_pdev(), then null pointer dereference occurs<br>
since glue->musb wasn't initialized yet.<br>
<br>
The patch puts initializing of neccesery data before registration<br>
of the interrupt handler.<br>
<br>
Found by Linux Driver Verification project (<a href="http://linuxtesting.org" target="_blank">linuxtesting.org</a>).<br>
<br>
Signed-off-by: Nadezda Lutovinova <<a href="mailto:lutovinova@ispras.ru">lutovinova@ispras.ru</a>><br>
---<br>
drivers/usb/musb/musb_dsps.c | 13 ++++++-------<br>
1 file changed, 6 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c<br>
index 5892f3ce0cdc..ce9fc46c9266 100644<br>
--- a/drivers/usb/musb/musb_dsps.c<br>
+++ b/drivers/usb/musb/musb_dsps.c<br>
@@ -890,23 +890,22 @@ static int dsps_probe(struct platform_device *pdev)<br>
if (!glue->usbss_base)<br>
return -ENXIO;<br>
<br>
- if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) {<br>
- ret = dsps_setup_optional_vbus_irq(<wbr>pdev, glue);<br>
- if (ret)<br>
- goto err_iounmap;<br>
- }<br>
-<br>
platform_set_drvdata(pdev, glue);<br>
pm_runtime_enable(&pdev->dev);<br>
ret = dsps_create_musb_pdev(glue, pdev);<br>
if (ret)<br>
goto err;<br>
<br>
+ if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) {<br>
+ ret = dsps_setup_optional_vbus_irq(<wbr>pdev, glue);<br>
+ if (ret)<br>
+ goto err;<br>
+ }<br>
+<br>
return 0;<br>
<br>
err:<br>
pm_runtime_disable(&pdev->dev)<wbr>;<br>
-err_iounmap:<br>
iounmap(glue->usbss_base);<br>
return ret;<br>
}<br>
-- <br>
2.17.1<br>
<br>
</blockquote><br><br>-- <br>With Best Regards,<br>Andy Shevchenko<br><br><br>