patch usb-ldusb-should-signal-an-error-in-poll-if-the-device-is-disconnected.patch added to gregkh-2.6 tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to my gregkh-2.6 tree.  Its filename is

    usb-ldusb-should-signal-an-error-in-poll-if-the-device-is-disconnected.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From oliver@xxxxxxxxxx  Fri Jul 10 15:18:16 2009
From: Oliver Neukum <oliver@xxxxxxxxxx>
Date: Thu, 2 Jul 2009 17:01:06 +0200
Subject: USB: ldusb should signal an error in poll if the device is disconnected
To: Michael Hund <mhund@xxxxxxxxxxxxxx>, greg@xxxxxxxxx, USB list <linux-usb@xxxxxxxxxxxxxxx>
Message-ID: <200907021701.06689.oliver@xxxxxxxxxx>


poll() should test for a disconnection of the device.

Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
 drivers/usb/misc/ldusb.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -412,6 +412,9 @@ static unsigned int ld_usb_poll(struct f
 
 	dev = file->private_data;
 
+	if (!dev->intf)
+		return POLLERR | POLLHUP;
+
 	poll_wait(file, &dev->read_wait, wait);
 	poll_wait(file, &dev->write_wait, wait);
 
@@ -767,6 +770,9 @@ static void ld_usb_disconnect(struct usb
 		ld_usb_delete(dev);
 	} else {
 		dev->intf = NULL;
+		/* wake up pollers */
+		wake_up_interruptible_all(&dev->read_wait);
+		wake_up_interruptible_all(&dev->write_wait);
 		mutex_unlock(&dev->mutex);
 	}
 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux