]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.4.96/usb-option-fix-runtime-pm-handling.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 3.4.96 / usb-option-fix-runtime-pm-handling.patch
CommitLineData
c27f04b4
GKH
1From acf47d4f9c39b1cba467aa9442fc2efe0b1da741 Mon Sep 17 00:00:00 2001
2From: Johan Hovold <jhovold@gmail.com>
3Date: Mon, 26 May 2014 19:23:10 +0200
4Subject: USB: option: fix runtime PM handling
5
6From: Johan Hovold <jhovold@gmail.com>
7
8commit acf47d4f9c39b1cba467aa9442fc2efe0b1da741 upstream.
9
10Fix potential I/O while runtime suspended due to missing PM operations
11in send_setup.
12
13Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the
14option driver")
15
16Signed-off-by: Johan Hovold <jhovold@gmail.com>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19---
20 drivers/usb/serial/option.c | 15 ++++++++++++---
21 1 file changed, 12 insertions(+), 3 deletions(-)
22
23--- a/drivers/usb/serial/option.c
24+++ b/drivers/usb/serial/option.c
25@@ -1930,6 +1930,7 @@ static int option_send_setup(struct usb_
26 struct usb_wwan_port_private *portdata;
27 int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
28 int val = 0;
29+ int res;
30 dbg("%s", __func__);
31
32 if (is_blacklisted(ifNum, OPTION_BLACKLIST_SENDSETUP,
33@@ -1945,9 +1946,17 @@ static int option_send_setup(struct usb_
34 if (portdata->rts_state)
35 val |= 0x02;
36
37- return usb_control_msg(serial->dev,
38- usb_rcvctrlpipe(serial->dev, 0),
39- 0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT);
40+ res = usb_autopm_get_interface(serial->interface);
41+ if (res)
42+ return res;
43+
44+ res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
45+ 0x22, 0x21, val, ifNum, NULL,
46+ 0, USB_CTRL_SET_TIMEOUT);
47+
48+ usb_autopm_put_interface(serial->interface);
49+
50+ return res;
51 }
52
53 MODULE_AUTHOR(DRIVER_AUTHOR);