Skip to content

Commit 2cdd2a2

Browse files
oneukumsmb49
authored andcommitted
USB: usbtmc: use interruptible sleep in usbtmc_read
BugLink: https://bugs.launchpad.net/bugs/2115252 commit 054c514 upstream. usbtmc_read() calls usbtmc_generic_read() which uses interruptible sleep, but usbtmc_read() itself uses uninterruptble sleep for mutual exclusion between threads. That makes no sense. Both should use interruptible sleep. Fixes: 5b775f6 ("USB: add USB test and measurement class driver") Cc: stable <[email protected]> Signed-off-by: Oliver Neukum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 84d5208 commit 2cdd2a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/usb/class/usbtmc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,10 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
13801380
if (!buffer)
13811381
return -ENOMEM;
13821382

1383-
mutex_lock(&data->io_mutex);
1383+
retval = mutex_lock_interruptible(&data->io_mutex);
1384+
if (retval < 0)
1385+
goto exit_nolock;
1386+
13841387
if (data->zombie) {
13851388
retval = -ENODEV;
13861389
goto exit;
@@ -1503,6 +1506,7 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
15031506

15041507
exit:
15051508
mutex_unlock(&data->io_mutex);
1509+
exit_nolock:
15061510
kfree(buffer);
15071511
return retval;
15081512
}

0 commit comments

Comments
 (0)