diff mbox series

usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data

Message ID 20250422185601.80199-1-wahrenst@gmx.net
State New
Headers show
Series usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data | expand

Commit Message

Stefan Wahren April 22, 2025, 6:56 p.m. UTC
The commit 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's
refcount in .remove() and in the error path of .probe()") introduced
a NULL pointer dereference on platforms which have no usbmisc_data
(e.g. i.MX28). So add the missing checks in .probe() and .remove().

Fixes: 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()")
Cc: <stable@kernel.org>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Greg Kroah-Hartman May 1, 2025, 3:38 p.m. UTC | #1
On Tue, Apr 22, 2025 at 08:56:01PM +0200, Stefan Wahren wrote:
> The commit 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's
> refcount in .remove() and in the error path of .probe()") introduced
> a NULL pointer dereference on platforms which have no usbmisc_data
> (e.g. i.MX28). So add the missing checks in .probe() and .remove().
> 
> Fixes: 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()")
> Cc: <stable@kernel.org>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Does not apply to 6.15-rc4 at all, can you rebase and resubmit?

thanks,

greg k-h
Stefan Wahren May 2, 2025, 8:35 a.m. UTC | #2
Am 01.05.25 um 17:38 schrieb Greg Kroah-Hartman:
> On Tue, Apr 22, 2025 at 08:56:01PM +0200, Stefan Wahren wrote:
>> The commit 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's
>> refcount in .remove() and in the error path of .probe()") introduced
>> a NULL pointer dereference on platforms which have no usbmisc_data
>> (e.g. i.MX28). So add the missing checks in .probe() and .remove().
>>
>> Fixes: 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()")
>> Cc: <stable@kernel.org>
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> ---
>>   drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
> Does not apply to 6.15-rc4 at all, can you rebase and resubmit?
Sorry, i didn't noticed that Fedor Pchelkin already send "usb: chipidea: 
ci_hdrc_imx: fix usbmisc handling" in March to fix this.

Regards
>
> thanks,
>
> greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 1a7fc638213e..619779eef333 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -534,7 +534,8 @@  static int ci_hdrc_imx_probe(struct platform_device *pdev)
 		cpu_latency_qos_remove_request(&data->pm_qos_req);
 	data->ci_pdev = NULL;
 err_put:
-	put_device(data->usbmisc_data->dev);
+	if (data->usbmisc_data)
+		put_device(data->usbmisc_data->dev);
 	return ret;
 }
 
@@ -559,7 +560,8 @@  static void ci_hdrc_imx_remove(struct platform_device *pdev)
 		if (data->hsic_pad_regulator)
 			regulator_disable(data->hsic_pad_regulator);
 	}
-	put_device(data->usbmisc_data->dev);
+	if (data->usbmisc_data)
+		put_device(data->usbmisc_data->dev);
 }
 
 static void ci_hdrc_imx_shutdown(struct platform_device *pdev)