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:11:56 +0000 (20:11 -0700)
commit5a77e53bb1cb996391ab1feb898b6ffb0657f96f
treec43ffb9ce743efafecb6adf3c3200d4dec258a4d
parent2f59a10cb390aaa74dda48ca73214d8ce52d3c2b
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