]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: mdc800: handle signal and read racing
authorOliver Neukum <oneukum@suse.com>
Mon, 9 Feb 2026 14:20:48 +0000 (15:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Feb 2026 18:26:46 +0000 (10:26 -0800)
If a signal arrives after a read has partially completed,
we need to return the number of bytes read. -EINTR is correct
only if that number is zero.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@kernel.org>
Link: https://patch.msgid.link/20260209142048.1503791-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/image/mdc800.c

index 8d8e79afa600436b45fa342f0a4ebc57e0427dec..e76a502fa9dab007b72c5a703fdd379125809d29 100644 (file)
@@ -707,7 +707,7 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l
                if (signal_pending (current)) 
                {
                        mutex_unlock(&mdc800->io_lock);
-                       return -EINTR;
+                       return len == left ? -EINTR : len-left;
                }
 
                sts=left > (mdc800->out_count-mdc800->out_ptr)?mdc800->out_count-mdc800->out_ptr:left;