Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 6bc235a2e24a5 ("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>

authored by

Oliver Neukum and committed by
Greg Kroah-Hartman
e0aa9614 44feafba

+4 -5
-4
drivers/usb/misc/iowarrior.c
··· 911 911 static void iowarrior_disconnect(struct usb_interface *interface) 912 912 { 913 913 struct iowarrior *dev = usb_get_intfdata(interface); 914 - int minor = dev->minor; 915 914 916 915 usb_deregister_dev(interface, &iowarrior_class); 917 916 ··· 934 935 mutex_unlock(&dev->mutex); 935 936 iowarrior_delete(dev); 936 937 } 937 - 938 - dev_info(&interface->dev, "I/O-Warror #%d now disconnected\n", 939 - minor - IOWARRIOR_MINOR_BASE); 940 938 } 941 939 942 940 /* usb specific object needed to register this driver with the usb subsystem */
+4 -1
drivers/usb/misc/yurex.c
··· 444 444 if (count == 0) 445 445 goto error; 446 446 447 - mutex_lock(&dev->io_mutex); 447 + retval = mutex_lock_interruptible(&dev->io_mutex); 448 + if (retval < 0) 449 + return -EINTR; 450 + 448 451 if (dev->disconnected) { /* already disconnected */ 449 452 mutex_unlock(&dev->io_mutex); 450 453 retval = -ENODEV;