USB: cdc-acm: fix potential urb leak and PM imbalance in write
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:41 +0000 (19:23 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 Jul 2014 12:33:41 +0000 (13:33 +0100)
commit5ddef05cc4fc70feb34fc0cd696edc55af6eccd4
tree6b3bae4223da8d1d8afe0e77b3e1b1d29a2a8bb2
parent57eb9099f3842564bbca138d06069e5053fdb4df
USB: cdc-acm: fix potential urb leak and PM imbalance in write

commit 183a45087d126d126e8dd1d9b2602fc129dff9ad upstream.

Make sure to check return value of autopm get in write() in order to
avoid urb leak and PM counter imbalance on errors.

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>
[bwh: Backported to 3.2:
 - Adjust context
 - Error/status variable is called rc, not stat]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/class/cdc-acm.c