USB: cdc-wdm: poll must return POLLHUP if device is gone
authorBjørn Mork <bjorn@mork.no>
Wed, 9 May 2012 11:53:21 +0000 (13:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 May 2012 22:19:22 +0000 (15:19 -0700)
Else the poll will be restarted indefinitely in a tight loop,
preventing final device cleanup.

Cc: Oliver Neukum <oliver@neukum.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-wdm.c

index 5d151653ae432b86385d8159660200b0b0d1c7d9..765227575d3b21436f7f9fd5c4b6f4cd8c95eff7 100644 (file)
@@ -548,7 +548,7 @@ static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
 
        spin_lock_irqsave(&desc->iuspin, flags);
        if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
-               mask = POLLERR;
+               mask = POLLHUP | POLLERR;
                spin_unlock_irqrestore(&desc->iuspin, flags);
                goto desc_out;
        }