usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ
Greg Kroah-Hartman
maintainerPATCH 7/12 usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ
Quoted 17 lines · Oliver Neukum
Am Donnerstag, den 17.05.2018, 19:03 +0200 schrieb Guido Kiener:
Quoted 16 lines
(quoted diff) +16
-0+static int usbtmc488_ioctl_wait_srq(struct usbtmc_file_data *file_data, + unsigned int __user *arg) +{ + struct usbtmc_device_data *data = file_data->data; + struct device *dev = &data->intf->dev; + int rv; + unsigned int timeout; + unsigned long expire; + + if (!data->iin_ep_present) { + dev_dbg(dev, "no interrupt endpoint present\n"); + return -EFAULT; + } + + if (get_user(timeout, arg)) + return -EFAULT;
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ + expire = msecs_to_jiffies(timeout); + + mutex_unlock(&data->io_mutex);There is such a thing as threads sharing file descriptors. That leads to the question what happens to the mutex if this
ioctl()is called multiple times.
Processes can share file descriptors as well, no need to mess with a thread :)
good catch.
greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html