USB: serial: fix potential runtime pm imbalance at device remove
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:33 +0000 (19:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2014 03:09:44 +0000 (20:09 -0700)
commitde8e4ac54c25de31540722defe639ed320b9c5fb
tree739a351dc9190ea4016a4d8e12357d17d1826bfc
parentb29a81694c1764194c67ee65678d17a5c9c325d9
USB: serial: fix potential runtime pm imbalance at device remove

commit c14829fad88dbeda57253590695b85ba51270621 upstream.

Only call usb_autopm_put_interface() if the corresponding
usb_autopm_get_interface() was successful.

This prevents a potential runtime PM counter imbalance should
usb_autopm_get_interface() fail. Note that the USB PM usage counter is
reset when the interface is unbound, but that the runtime PM counter may
be left unbalanced.

Also add comment on why we don't need to worry about racing
resume/suspend on autopm_get failures.

Fixes: d5fd650cfc7f ("usb: serial: prevent suspend/resume from racing
against probe/remove")

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