This is a note to let you know that I've just added the patch titled USB: serial: fix potential runtime pm imbalance at device remove to the 3.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-serial-fix-potential-runtime-pm-imbalance-at-device-remove.patch and it can be found in the queue-3.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c14829fad88dbeda57253590695b85ba51270621 Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@xxxxxxxxx> Date: Mon, 26 May 2014 19:23:33 +0200 Subject: USB: serial: fix potential runtime pm imbalance at device remove From: Johan Hovold <jhovold@xxxxxxxxx> 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@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/serial/bus.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c @@ -98,13 +98,19 @@ static int usb_serial_device_remove(stru struct usb_serial_port *port; int retval = 0; int minor; + int autopm_err; port = to_usb_serial_port(dev); if (!port) return -ENODEV; - /* make sure suspend/resume doesn't race against port_remove */ - usb_autopm_get_interface(port->serial->interface); + /* + * Make sure suspend/resume doesn't race against port_remove. + * + * Note that no further runtime PM callbacks will be made if + * autopm_get fails. + */ + autopm_err = usb_autopm_get_interface(port->serial->interface); minor = port->number; tty_unregister_device(usb_serial_tty_driver, minor); @@ -118,7 +124,9 @@ static int usb_serial_device_remove(stru dev_info(dev, "%s converter now disconnected from ttyUSB%d\n", driver->description, minor); - usb_autopm_put_interface(port->serial->interface); + if (!autopm_err) + usb_autopm_put_interface(port->serial->interface); + return retval; } Patches currently in stable-queue which might be from jhovold@xxxxxxxxx are queue-3.10/usb-sierra-fix-urb-and-memory-leak-in-resume-error-path.patch queue-3.10/usb-sierra-fix-aa-deadlock-in-open-error-path.patch queue-3.10/usb-usb_wwan-fix-urb-leak-at-shutdown.patch queue-3.10/usb-qcserial-add-additional-sierra-wireless-qmi-devices.patch queue-3.10/usb-option-fix-runtime-pm-handling.patch queue-3.10/usb-sierra-fix-remote-wakeup.patch queue-3.10/usb-sierra-fix-urb-and-memory-leak-on-disconnect.patch queue-3.10/net-cpsw-fix-null-dereference-at-probe.patch queue-3.10/usb-sierra-fix-use-after-free-at-suspend-resume.patch queue-3.10/usb-usb_wwan-fix-write-and-suspend-race.patch queue-3.10/usb-serial-fix-potential-runtime-pm-imbalance-at-device-remove.patch queue-3.10/usb-usb_wwan-fix-potential-null-deref-at-resume.patch queue-3.10/usb-usb_wwan-fix-race-between-write-and-resume.patch queue-3.10/usb-usb_wwan-fix-potential-blocked-i-o-after-resume.patch queue-3.10/usb-usb_wwan-fix-urb-leak-in-write-error-path.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html