USB: cdc-acm: fix write and suspend race
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:36 +0000 (19:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Jun 2014 19:10:28 +0000 (15:10 -0400)
commitbe7978bb5b91ef7168a93cf91acd672dfb65f0d0
tree9a79d7836887761448eae32685808906e30de7e1
parent6fa2946224569a4f3f975f86193c02c754acc9d8
USB: cdc-acm: fix write and suspend race

commit 5a345c20c17d87099224a4be12e69e5bd7023dca 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 write_lock after determining the
device is idle but before incrementing the susp_count, thus leaving a
window where a concurrent write() can submit an urb.

Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices
that support remote wakeup")

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