* Linux driver of vt6656 from staging area causes system to freeze.
@ 2022-02-03 0:41 Philipp Hortmann
2022-02-03 8:54 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Hortmann @ 2022-02-03 0:41 UTC (permalink / raw)
To: kernelnewbies; +Cc: Greg Kroah-Hartman, Forest Bond
I managed to get a device vt6656 (USB WiFi adapter). The device works OK
when the computer is started and driver loaded. When the WLAN is
disabled the system freezes often.
I am using ubuntu 20.04 with kernel 5.17.0-rc1 x86_64
branch: staging-testing
After some tries I found out that it is a function in vnt_stop()
main_usb.c with the following line that is causing this.
usb_kill_urb(priv→interrupt_urb);
But this memory is after this line still in use.
Digging deeper I found that the usb_submit_urb() function (in usbpipe.c
vnt_start_interrupt_urb_complete) is called after the usb_kill_urb() is
executed.
So I tied the execution of the usb_submit_urb() to a flag called
DEVICE_FLAGS_DISCONNECTED. After that no crashes were observed.
So here my questions:
- Is this the right place to fix?
- Do I need to log a bug report before a patch?
Here a patch proposal:
From d403ed1a1c2483a3a8b44e96c12edbfa2a53d356 Mon Sep 17 00:00:00 2001
From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Date: Wed, 2 Feb 2022 20:15:04 +0100
Subject: [PATCH] staging: vt6656: Fix crash when WLAN is turned off
To: Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman
<gregkh@linuxfoundation.org>,linux-staging@lists.linux.dev,linux-kernel@vger.kernel.org
Stop submitting urbs before calling usb_kill_urb() and usb_free_urb().
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
drivers/staging/vt6656/usbpipe.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/vt6656/usbpipe.c
b/drivers/staging/vt6656/usbpipe.c
index 7f45734390f6..d505b4b69ba4 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -230,7 +230,9 @@ static void vnt_start_interrupt_urb_complete(struct
urb *urb)
else
vnt_int_process_data(priv);
- status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC);
+ if (!test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags))
+ status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC);
+
if (status)
dev_dbg(&priv->usb->dev, "Submit int URB failed %d\n", status);
}
--
2.25.1
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Linux driver of vt6656 from staging area causes system to freeze.
2022-02-03 0:41 Linux driver of vt6656 from staging area causes system to freeze Philipp Hortmann
@ 2022-02-03 8:54 ` Greg Kroah-Hartman
2022-02-03 19:19 ` Philipp Hortmann
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-03 8:54 UTC (permalink / raw)
To: Philipp Hortmann; +Cc: Forest Bond, kernelnewbies
On Thu, Feb 03, 2022 at 01:41:11AM +0100, Philipp Hortmann wrote:
> I managed to get a device vt6656 (USB WiFi adapter). The device works OK
> when the computer is started and driver loaded. When the WLAN is disabled
> the system freezes often.
>
> I am using ubuntu 20.04 with kernel 5.17.0-rc1 x86_64
> branch: staging-testing
>
> After some tries I found out that it is a function in vnt_stop() main_usb.c
> with the following line that is causing this.
> usb_kill_urb(priv→interrupt_urb);
> But this memory is after this line still in use.
What "memory" do you mean?
> Digging deeper I found that the usb_submit_urb() function (in usbpipe.c
> vnt_start_interrupt_urb_complete) is called after the usb_kill_urb() is
> executed.
>
> So I tied the execution of the usb_submit_urb() to a flag called
> DEVICE_FLAGS_DISCONNECTED. After that no crashes were observed.
>
> So here my questions:
> - Is this the right place to fix?
Does it work for you? If so, let's try it.
> - Do I need to log a bug report before a patch?
Not at all. Please read the documention for how to submit a kernel
patch and we can take it from there. The patch looks sane, now just
submit it correctly and we can review it and maybe apply it from there.
thanks,
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Linux driver of vt6656 from staging area causes system to freeze.
2022-02-03 8:54 ` Greg Kroah-Hartman
@ 2022-02-03 19:19 ` Philipp Hortmann
0 siblings, 0 replies; 3+ messages in thread
From: Philipp Hortmann @ 2022-02-03 19:19 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Forest Bond, kernelnewbies
On 2/3/22 09:54, Greg Kroah-Hartman wrote:
> On Thu, Feb 03, 2022 at 01:41:11AM +0100, Philipp Hortmann wrote:
>> I managed to get a device vt6656 (USB WiFi adapter). The device works OK
>> when the computer is started and driver loaded. When the WLAN is disabled
>> the system freezes often.
>>
>> I am using ubuntu 20.04 with kernel 5.17.0-rc1 x86_64
>> branch: staging-testing
>>
>> After some tries I found out that it is a function in vnt_stop() main_usb.c
>> with the following line that is causing this.
>> usb_kill_urb(priv→interrupt_urb);
>> But this memory is after this line still in use.
>
> What "memory" do you mean?
They are calling usb_kill_urb(priv→interrupt_urb); while using
priv→interrupt_urb and maybe also starting new
usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC);
Thanks for your quick answer.
Bye Philipp
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-03 19:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-03 0:41 Linux driver of vt6656 from staging area causes system to freeze Philipp Hortmann
2022-02-03 8:54 ` Greg Kroah-Hartman
2022-02-03 19:19 ` Philipp Hortmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox