Skip to contentSkip to conversation

usb: mdc800: handle signal and read racing

PATCH New Oliver Neukum 1 participant 1 message Feb 9 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: mdc800: handle signal and read racing

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.

---
 drivers/usb/image/mdc800.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/image/mdc800.c +1 -1
index 7b7e1554ea20..9132cc3a575b 100644
@@ -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;
Signature · 1 line
2.53.0