* [PATCH -next] staging: r8188eu: fix missing unlock in rtw_resume()
@ 2021-10-28 9:40 Yang Yingliang
2021-10-28 10:40 ` Fabio M. De Francesco
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-10-28 9:40 UTC (permalink / raw)
To: linux-kernel, linux-staging; +Cc: Larry.Finger, phil, gregkh
Add the missing unlock before return from rtw_resume().
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/staging/r8188eu/os_dep/usb_intf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 6b93830130e7..5a35d9fe3fc9 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -298,8 +298,10 @@ static int rtw_resume(struct usb_interface *pusb_intf)
pwrpriv->bkeepfwalive = false;
DBG_88E("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
- if (pm_netdev_open(pnetdev, true) != 0)
+ if (pm_netdev_open(pnetdev, true) != 0) {
+ mutex_unlock(&pwrpriv->lock);
goto exit;
+ }
netif_device_attach(pnetdev);
netif_carrier_on(pnetdev);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] staging: r8188eu: fix missing unlock in rtw_resume()
2021-10-28 9:40 [PATCH -next] staging: r8188eu: fix missing unlock in rtw_resume() Yang Yingliang
@ 2021-10-28 10:40 ` Fabio M. De Francesco
0 siblings, 0 replies; 2+ messages in thread
From: Fabio M. De Francesco @ 2021-10-28 10:40 UTC (permalink / raw)
To: linux-kernel, linux-staging, Yang Yingliang; +Cc: Larry.Finger, phil, gregkh
On Thursday, October 28, 2021 11:40:38 AM CEST Yang Yingliang wrote:
> Add the missing unlock before return from rtw_resume().
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for
RTL8188eu driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/staging/r8188eu/os_dep/usb_intf.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/
r8188eu/os_dep/usb_intf.c
> index 6b93830130e7..5a35d9fe3fc9 100644
> --- a/drivers/staging/r8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
> @@ -298,8 +298,10 @@ static int rtw_resume(struct usb_interface *pusb_intf)
> pwrpriv->bkeepfwalive = false;
>
> DBG_88E("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
> - if (pm_netdev_open(pnetdev, true) != 0)
> + if (pm_netdev_open(pnetdev, true) != 0) {
> + mutex_unlock(&pwrpriv->lock);
> goto exit;
> + }
>
> netif_device_attach(pnetdev);
> netif_carrier_on(pnetdev);
> --
> 2.25.1
>
Good catch, well done!
I recently replaced semaphores with mutexes in this and other r8188eu driver
functions (commit 7e4c7947b42c "staging: r8188eu: Use a Mutex instead of a
binary semaphore") but, while making those changes, I didn't notice that the
'if' in rtw_resume () can lead to a jump to the "exit" label without properly
unlocking the "pwrpriv-> lock" mutex.
Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Thank you,
Fabio
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-28 10:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-28 9:40 [PATCH -next] staging: r8188eu: fix missing unlock in rtw_resume() Yang Yingliang
2021-10-28 10:40 ` Fabio M. De Francesco
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.