diff mbox series

[RFC,5/7] CDC-WDM: correct error reporting in write()

Message ID 20200922112126.16919-6-oneukum@suse.com (mailing list archive)
State New, archived
Headers show
Series [RFC,1/7] CDC-WDM: fix hangs in flush() in multithreaded cases | expand

Commit Message

Oliver Neukum Sept. 22, 2020, 11:21 a.m. UTC
In case our wait was interrupted by a disconnect, we should report
that.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/class/cdc-wdm.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 5fb855404403..242f83118208 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -396,6 +396,9 @@  static ssize_t wdm_write
 	if (test_bit(WDM_RESETTING, &desc->flags))
 		r = -EIO;
 
+	if (test_bit(WDM_DISCONNECTING, &desc->flags))
+		r = -ENODEV;
+
 	if (r < 0) {
 		rv = r;
 		goto out_free_mem_pm;