Commit d12b85e7 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: ldusb should signal an error in poll if the device is disconnected

poll() should test for a disconnection of the device.
Signed-off-by: default avatarOliver Neukum <oliver@neukum.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d35b4ce1
...@@ -412,6 +412,9 @@ static unsigned int ld_usb_poll(struct file *file, poll_table *wait) ...@@ -412,6 +412,9 @@ static unsigned int ld_usb_poll(struct file *file, poll_table *wait)
dev = file->private_data; dev = file->private_data;
if (!dev->intf)
return POLLERR | POLLHUP;
poll_wait(file, &dev->read_wait, wait); poll_wait(file, &dev->read_wait, wait);
poll_wait(file, &dev->write_wait, wait); poll_wait(file, &dev->write_wait, wait);
...@@ -767,6 +770,9 @@ static void ld_usb_disconnect(struct usb_interface *intf) ...@@ -767,6 +770,9 @@ static void ld_usb_disconnect(struct usb_interface *intf)
ld_usb_delete(dev); ld_usb_delete(dev);
} else { } else {
dev->intf = NULL; dev->intf = NULL;
/* wake up pollers */
wake_up_interruptible_all(&dev->read_wait);
wake_up_interruptible_all(&dev->write_wait);
mutex_unlock(&dev->mutex); mutex_unlock(&dev->mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment