From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2DBBECE599 for ; Wed, 16 Oct 2019 22:01:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFF4E218DE for ; Wed, 16 Oct 2019 22:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263313; bh=majxEuL7VpOdF5gmfB0VT/XgrY8AjwHSQ50imORUPb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XhJC+qT9eaKx6XsDbypoZYq7GJppSvqifDniigXPzuCuAw6xD5jBqAXdWRjW3flK8 1J/I35ky63ywyDvEFGW6Mk0jyi0647SWSeK2boayPGUDa3s5HBeykqoms/HmdP3inh Iij1COB+F7CZqYVVUa/T6GfGWJuh5bqtfX6asANc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406752AbfJPWAQ (ORCPT ); Wed, 16 Oct 2019 18:00:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:53538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438406AbfJPV7J (ORCPT ); Wed, 16 Oct 2019 17:59:09 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C029521D7A; Wed, 16 Oct 2019 21:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263149; bh=majxEuL7VpOdF5gmfB0VT/XgrY8AjwHSQ50imORUPb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJwi8z+Wnb+q6IJS2UfhTYTyjEuSCjNSqg4XSE6Y+KZydtDYhptceh6c6fMxCRF4a 2faJTCXtYzscwMxyRYKAZMR3Ev9w09lP6uEKZ3KCylssFueP3QC+xbzZnvtHeKg0rh PcAUAGhCqrjZR/8Ot3y+vXdt2qD5xzttK+asibZ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.3 021/112] USB: usblp: fix runtime PM after driver unbind Date: Wed, 16 Oct 2019 14:50:13 -0700 Message-Id: <20191016214850.124564321@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 9a31535859bfd8d1c3ed391f5e9247cd87bb7909 upstream. Since commit c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") USB drivers must always balance their runtime PM gets and puts, including when the driver has already been unbound from the interface. Leaving the interface with a positive PM usage counter would prevent a later bound driver from suspending the device. Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") Cc: stable Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20191001084908.2003-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/usblp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -461,10 +461,12 @@ static int usblp_release(struct inode *i mutex_lock(&usblp_mutex); usblp->used = 0; - if (usblp->present) { + if (usblp->present) usblp_unlink_urbs(usblp); - usb_autopm_put_interface(usblp->intf); - } else /* finish cleanup from disconnect */ + + usb_autopm_put_interface(usblp->intf); + + if (!usblp->present) /* finish cleanup from disconnect */ usblp_cleanup(usblp); mutex_unlock(&usblp_mutex); return 0;