diff options
author | Johan Hovold <jhovold@gmail.com> | 2014-05-26 19:23:41 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-07-11 13:33:41 +0100 |
commit | 5ddef05cc4fc70feb34fc0cd696edc55af6eccd4 (patch) | |
tree | 6b3bae4223da8d1d8afe0e77b3e1b1d29a2a8bb2 /drivers | |
parent | 57eb9099f3842564bbca138d06069e5053fdb4df (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index ed988effdf07..29e76be1d5eb 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -191,7 +191,13 @@ static int acm_write_start(struct acm *acm, int wbn) dev_vdbg(&acm->data->dev, "%s - susp_count %d\n", __func__, acm->susp_count); - usb_autopm_get_interface_async(acm->control); + rc = usb_autopm_get_interface_async(acm->control); + if (rc) { + wb->use = 0; + spin_unlock_irqrestore(&acm->write_lock, flags); + return rc; + } + if (acm->susp_count) { usb_anchor_urb(wb->urb, &acm->delayed); spin_unlock_irqrestore(&acm->write_lock, flags); |