Skip to content

Commit e0aa961

Browse files
oneukumgregkh
authored andcommitted
usb: yurex: make waiting on yurex_write interruptible
The IO yurex_write() needs to wait for in order to have a device ready for writing again can take a long time time. Consequently the sleep is done in an interruptible state. Therefore others waiting for yurex_write() itself to finish should use mutex_lock_interruptible. Signed-off-by: Oliver Neukum <oneukum@suse.com> Fixes: 6bc235a ("USB: add driver for Meywa-Denki & Kayac YUREX") Rule: add Link: https://lore.kernel.org/stable/20240924084415.300557-1-oneukum%40suse.com Link: https://lore.kernel.org/r/20240924084415.300557-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 44feafb commit e0aa961

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

drivers/usb/misc/iowarrior.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,6 @@ static int iowarrior_probe(struct usb_interface *interface,
911911
static void iowarrior_disconnect(struct usb_interface *interface)
912912
{
913913
struct iowarrior *dev = usb_get_intfdata(interface);
914-
int minor = dev->minor;
915914

916915
usb_deregister_dev(interface, &iowarrior_class);
917916

@@ -935,9 +934,6 @@ static void iowarrior_disconnect(struct usb_interface *interface)
935934
mutex_unlock(&dev->mutex);
936935
iowarrior_delete(dev);
937936
}
938-
939-
dev_info(&interface->dev, "I/O-Warror #%d now disconnected\n",
940-
minor - IOWARRIOR_MINOR_BASE);
941937
}
942938

943939
/* usb specific object needed to register this driver with the usb subsystem */

drivers/usb/misc/yurex.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
444444
if (count == 0)
445445
goto error;
446446

447-
mutex_lock(&dev->io_mutex);
447+
retval = mutex_lock_interruptible(&dev->io_mutex);
448+
if (retval < 0)
449+
return -EINTR;
450+
448451
if (dev->disconnected) { /* already disconnected */
449452
mutex_unlock(&dev->io_mutex);
450453
retval = -ENODEV;

0 commit comments

Comments
 (0)