public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable
@ 2022-05-19  2:04 Li Zhengyu
  2022-05-19 15:55 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zhengyu @ 2022-05-19  2:04 UTC (permalink / raw)
  To: dbaryshkov; +Cc: stern, gregkh, linux-usb, linux-kernel

The return value of device_wakeup_enable() is unchecked, as the result
usb_remove_hcd() is unreachable even if device_wakeup_enable() is failed.

Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")

Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
---
 drivers/usb/host/ohci-tmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 49539b9f0e94..8148dc90c066 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -244,7 +244,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
 	if (ret)
 		goto err_add_hcd;
 
-	device_wakeup_enable(hcd->self.controller);
+	ret = device_wakeup_enable(hcd->self.controller);
 	if (ret == 0)
 		return ret;
 
-- 
2.17.1


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

* Re: [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable
  2022-05-19  2:04 [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable Li Zhengyu
@ 2022-05-19 15:55 ` Greg KH
  2022-05-20  1:39   ` lizhengyu (E)
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2022-05-19 15:55 UTC (permalink / raw)
  To: Li Zhengyu; +Cc: dbaryshkov, stern, linux-usb, linux-kernel

On Thu, May 19, 2022 at 10:04:34AM +0800, Li Zhengyu wrote:
> The return value of device_wakeup_enable() is unchecked, as the result
> usb_remove_hcd() is unreachable even if device_wakeup_enable() is failed.
> 
> Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
> 
> Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
> ---
>  drivers/usb/host/ohci-tmio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
> index 49539b9f0e94..8148dc90c066 100644
> --- a/drivers/usb/host/ohci-tmio.c
> +++ b/drivers/usb/host/ohci-tmio.c
> @@ -244,7 +244,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
>  	if (ret)
>  		goto err_add_hcd;
>  
> -	device_wakeup_enable(hcd->self.controller);
> +	ret = device_wakeup_enable(hcd->self.controller);
>  	if (ret == 0)
>  		return ret;

But now if there is an error you do not clean up properly, so you have
memory leaks?

How did you test this?

thanks,

greg k-h

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

* Re: [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable
  2022-05-19 15:55 ` Greg KH
@ 2022-05-20  1:39   ` lizhengyu (E)
  0 siblings, 0 replies; 3+ messages in thread
From: lizhengyu (E) @ 2022-05-20  1:39 UTC (permalink / raw)
  To: Greg KH; +Cc: dbaryshkov, stern, linux-usb, linux-kernel

On Thu, 19 May 2022 17:55:39 +0200, Greg KH <gregkh@linuxfoundation.org> 
wrote:
> On Thu, May 19, 2022 at 10:04:34AM +0800, Li Zhengyu wrote:
>> The return value of device_wakeup_enable() is unchecked, as the result
>> usb_remove_hcd() is unreachable even if device_wakeup_enable() is failed.
>>
>> Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
>>
>> Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
>> ---
>>   drivers/usb/host/ohci-tmio.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
>> index 49539b9f0e94..8148dc90c066 100644
>> --- a/drivers/usb/host/ohci-tmio.c
>> +++ b/drivers/usb/host/ohci-tmio.c
>> @@ -244,7 +244,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
>>   	if (ret)
>>   		goto err_add_hcd;
>>   
>> -	device_wakeup_enable(hcd->self.controller);
>> +	ret = device_wakeup_enable(hcd->self.controller);
>>   	if (ret == 0)
>>   		return ret;
> But now if there is an error you do not clean up properly, so you have
> memory leaks?
>
> How did you test this?
There is no test. It is a suggest by Dmitry Baryshkov in previous patch 
https://lore.kernel.org/all/CALT56yO_ek55BGX4cKuTim2gWwQp7EXUFyh332MPYHPdi7xEWw@mail.gmail.com/ 

>
> thanks,
>
> greg k-h
> .

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

end of thread, other threads:[~2022-05-20  1:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-19  2:04 [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable Li Zhengyu
2022-05-19 15:55 ` Greg KH
2022-05-20  1:39   ` lizhengyu (E)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox