Commit 054c5145 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman
Browse files

USB: usbtmc: use interruptible sleep in usbtmc_read



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: 5b775f67 ("USB: add USB test and measurement class driver")
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20250430134810.226015-1-oneukum@suse.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8614ecdb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1380,7 +1380,10 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
	if (!buffer)
		return -ENOMEM;

	mutex_lock(&data->io_mutex);
	retval = mutex_lock_interruptible(&data->io_mutex);
	if (retval < 0)
		goto exit_nolock;

	if (data->zombie) {
		retval = -ENODEV;
		goto exit;
@@ -1503,6 +1506,7 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,

exit:
	mutex_unlock(&data->io_mutex);
exit_nolock:
	kfree(buffer);
	return retval;
}