cdc-acm: fix power management in ioctl
authorOliver Neukum <oneukum@suse.de>
Wed, 20 Nov 2013 10:35:36 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Dec 2013 18:23:46 +0000 (10:23 -0800)
An ioctl that does depends on communication with a device should
prevent suspension of teh device.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c

index 92e28ecda83459addd4ef7c01167595c9088099b..8fe32eb7970e9050b4de92969ee501a914fb890d 100644 (file)
@@ -888,7 +888,13 @@ static int acm_tty_ioctl(struct tty_struct *tty,
                rv = set_serial_info(acm, (struct serial_struct __user *) arg);
                break;
        case TIOCMIWAIT:
+               rv = usb_autopm_get_interface(acm->control);
+               if (rv < 0) {
+                       rv = -EIO;
+                       break;
+               }
                rv = wait_serial_change(acm, arg);
+               usb_autopm_put_interface(acm->control);
                break;
        case TIOCGICOUNT:
                rv = get_serial_usage(acm, (struct serial_icounter_struct __user *) arg);