linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data
@ 2025-04-22 18:56 Stefan Wahren
  2025-05-01 15:38 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Wahren @ 2025-04-22 18:56 UTC (permalink / raw)
  To: Peter Chen, Greg Kroah-Hartman, Shawn Guo, Sascha Hauer
  Cc: kernel, Fabio Estevam, Joe Hattori, linux-arm-kernel, linux-usb,
	imx, Stefan Wahren, stable

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(-)

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)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data
  2025-04-22 18:56 [PATCH] usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data Stefan Wahren
@ 2025-05-01 15:38 ` Greg Kroah-Hartman
  2025-05-02  8:35   ` Stefan Wahren
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-05-01 15:38 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Peter Chen, Shawn Guo, Sascha Hauer, kernel, Fabio Estevam,
	Joe Hattori, linux-arm-kernel, linux-usb, imx, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data
  2025-05-01 15:38 ` Greg Kroah-Hartman
@ 2025-05-02  8:35   ` Stefan Wahren
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Wahren @ 2025-05-02  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Peter Chen, Shawn Guo, Sascha Hauer, kernel, Fabio Estevam,
	Joe Hattori, linux-arm-kernel, linux-usb, imx, stable

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-02  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 18:56 [PATCH] usb: chipidea: ci_hdrc_imx: Fix NPD of usbmisc_data Stefan Wahren
2025-05-01 15:38 ` Greg Kroah-Hartman
2025-05-02  8:35   ` Stefan Wahren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).