summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/option.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2014-05-26 21:23:10 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-28 02:04:05 +0400
commitacf47d4f9c39b1cba467aa9442fc2efe0b1da741 (patch)
tree1bd6c36ba7e746904685ab0ef6627eef0b682af4 /drivers/usb/serial/option.c
parentc2e45d704723723e5691c7b4bcd0ff4aeb813522 (diff)
downloadlinux-acf47d4f9c39b1cba467aa9442fc2efe0b1da741.tar.xz
USB: option: fix runtime PM handling
Fix potential I/O while runtime suspended due to missing PM operations in send_setup. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Cc: <stable@vger.kernel.org> # v2.6.32 Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r--drivers/usb/serial/option.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f213ee978516..802c0693e5c9 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1923,6 +1923,7 @@ static int option_send_setup(struct usb_serial_port *port)
struct option_private *priv = intfdata->private;
struct usb_wwan_port_private *portdata;
int val = 0;
+ int res;
portdata = usb_get_serial_port_data(port);
@@ -1931,9 +1932,17 @@ static int option_send_setup(struct usb_serial_port *port)
if (portdata->rts_state)
val |= 0x02;
- return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+ res = usb_autopm_get_interface(serial->interface);
+ if (res)
+ return res;
+
+ res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
0x22, 0x21, val, priv->bInterfaceNumber, NULL,
0, USB_CTRL_SET_TIMEOUT);
+
+ usb_autopm_put_interface(serial->interface);
+
+ return res;
}
MODULE_AUTHOR(DRIVER_AUTHOR);