USB: usb_wwan: fix write and suspend race
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:15 +0000 (19:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2014 03:01:32 +0000 (20:01 -0700)
commit887b3c368f744e95538a6ab0f9d91d21d933c5c4
treee33849a55881e642c5d55879617fec10fb4c0b45
parent50476eeb49caef5d03baec2ca9ca1187bb87b738
USB: usb_wwan: fix write and suspend race

commit 170fad9e22df0063eba0701adb966786d7a4ec5a upstream.

Fix race between write() and suspend() which could lead to writes being
dropped (or I/O while suspended) if the device is runtime suspended
while a write request is being processed.

Specifically, suspend() releases the susp_lock after determining the
device is idle but before setting the suspended flag, thus leaving a
window where a concurrent write() can submit an urb.

Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the
option driver")

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/usb_wwan.c