From: Suwan Kim <suwan.kim027@gmail.com>
To: shuah@kernel.org, valentina.manea.m@gmail.com,
gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Suwan Kim <suwan.kim027@gmail.com>
Subject: [PATCH] usbip: Support error(event) detection in vhci_tx_loop() kernel thread
Date: Mon, 25 Mar 2019 23:23:32 +0900 [thread overview]
Message-ID: <20190325142332.3917-1-suwan.kim027@gmail.com> (raw)
In the case of stub driver and vudc driver, tx threads have error
(event) detection logic that is usbip_event_happened() and checks
error condition and halts the tx thread if there is an error. However,
vhci_tx_loop() has no error detection logic and there is a possibility
that an error(event) may occur before vhci_tx_loop() is executed.
For example, assume that a driver uses multiple URBs. vhci_rx_loop()
receives a URB and gives the URB to the device driver calling URB
complete function. And URB complete function calls usb_submit_urb()
and vhci_urb_enqueue() which wakes up the tx thread (vhci_tx_loop()).
And there is possible situation that the first URB is successfully
received but receiving second URB fails and the tx thread is scheduled
but not yet executed. In this situation, the tx thread must detect an
error in rx path and terminate itself when it is executed.
Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
---
drivers/usb/usbip/vhci_tx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/usbip/vhci_tx.c b/drivers/usb/usbip/vhci_tx.c
index 9aed15a358b7..004c91aa75ed 100644
--- a/drivers/usb/usbip/vhci_tx.c
+++ b/drivers/usb/usbip/vhci_tx.c
@@ -195,6 +195,9 @@ int vhci_tx_loop(void *data)
struct vhci_device *vdev = container_of(ud, struct vhci_device, ud);
while (!kthread_should_stop()) {
+ if (usbip_event_happened(ud))
+ break;
+
if (vhci_send_cmd_submit(vdev) < 0)
break;
--
2.20.1
reply other threads:[~2019-03-25 14:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190325142332.3917-1-suwan.kim027@gmail.com \
--to=suwan.kim027@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®