]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.96/usb-usb_wwan-fix-urb-leak-in-write-error-path.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 3.4.96 / usb-usb_wwan-fix-urb-leak-in-write-error-path.patch
1 From db0904737947d509844e171c9863ecc5b4534005 Mon Sep 17 00:00:00 2001
2 From: xiao jin <jin.xiao@intel.com>
3 Date: Mon, 26 May 2014 19:23:13 +0200
4 Subject: USB: usb_wwan: fix urb leak in write error path
5
6 From: xiao jin <jin.xiao@intel.com>
7
8 commit db0904737947d509844e171c9863ecc5b4534005 upstream.
9
10 When enable usb serial for modem data, sometimes the tty is blocked
11 in tty_wait_until_sent because portdata->out_busy always is set and
12 have no chance to be cleared.
13
14 We find a bug in write error path. usb_wwan_write set portdata->out_busy
15 firstly, then try autopm async with error. No out urb submit and no
16 usb_wwan_outdat_callback to this write, portdata->out_busy can't be
17 cleared.
18
19 This patch clear portdata->out_busy if usb_wwan_write try autopm async
20 with error.
21
22 Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the
23 option driver")
24
25 Signed-off-by: xiao jin <jin.xiao@intel.com>
26 Signed-off-by: Zhang, Qi1 <qi1.zhang@intel.com>
27 Reviewed-by: David Cohen <david.a.cohen@linux.intel.com>
28 Signed-off-by: Johan Hovold <jhovold@gmail.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 drivers/usb/serial/usb_wwan.c | 4 +++-
33 1 file changed, 3 insertions(+), 1 deletion(-)
34
35 --- a/drivers/usb/serial/usb_wwan.c
36 +++ b/drivers/usb/serial/usb_wwan.c
37 @@ -236,8 +236,10 @@ int usb_wwan_write(struct tty_struct *tt
38 usb_pipeendpoint(this_urb->pipe), i);
39
40 err = usb_autopm_get_interface_async(port->serial->interface);
41 - if (err < 0)
42 + if (err < 0) {
43 + clear_bit(i, &portdata->out_busy);
44 break;
45 + }
46
47 /* send the data */
48 memcpy(this_urb->transfer_buffer, buf, todo);