]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iowarrior: use interruptible lock in iowarrior_write()
authorOliver Neukum <oneukum@suse.com>
Thu, 12 Mar 2026 09:45:28 +0000 (10:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2026 15:02:20 +0000 (16:02 +0100)
The function itself, if it has to wait to perform
IO, use interruptible sleep. Hence the sleep needed
to avoid the write code path racing with itself should also
use interruptible sleep.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://patch.msgid.link/20260312094619.1590556-2-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/iowarrior.c

index 5b31e5669d5307e9a2a53ff5df32d93337ca6421..0b377204374f4fadda94aba0e45f43ca38b7ed66 100644 (file)
@@ -362,13 +362,16 @@ static ssize_t iowarrior_write(struct file *file,
                               size_t count, loff_t *ppos)
 {
        struct iowarrior *dev;
-       int retval = 0;
+       int retval;
        char *buf = NULL;       /* for IOW24 and IOW56 we need a buffer */
        struct urb *int_out_urb = NULL;
 
        dev = file->private_data;
 
-       mutex_lock(&dev->mutex);
+       retval = mutex_lock_interruptible(&dev->mutex);
+       if (retval < 0)
+               return -EINTR;
+
        /* verify that the device wasn't unplugged */
        if (!dev->present) {
                retval = -ENODEV;