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 149E8FA372B for ; Wed, 16 Oct 2019 22:11:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5BBE207FF for ; Wed, 16 Oct 2019 22:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263868; bh=majxEuL7VpOdF5gmfB0VT/XgrY8AjwHSQ50imORUPb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hg+eJORk7ibTrkfQr8IN3vWYqaPynqqWQIpUKtZ3bu9DJbQ5gjtXkegpDU+OYTW30 9uFE2LO0vC0QA970itVIISzFWlW+P93/zJCL9WU+soLBa+yDkNNT1gxniAR70eyBJk EvFCxoAdFEauVKpMd2nklmKTl6+2m1CAsAjSOF80= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391417AbfJPV5B (ORCPT ); Wed, 16 Oct 2019 17:57:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:49268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437949AbfJPV5B (ORCPT ); Wed, 16 Oct 2019 17:57:01 -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 49F4C21D7D; Wed, 16 Oct 2019 21:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263020; bh=majxEuL7VpOdF5gmfB0VT/XgrY8AjwHSQ50imORUPb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/3OXi3mc5uqiTUMIY8cDFwplQNe5yh75Ok8oLQfsy7j8ywVCLE0JNMVzeoGW48GK 2wOGIrfbI9ZE/IcBAUj8fnT+VmqijyciDjH2p/KUnMENG1oXXfdRSl46yNFiQuQkvf fn5gDovF8FGdlAm+F2luozcHBO4+BG7pQ7fYSeU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.19 21/81] USB: usblp: fix runtime PM after driver unbind Date: Wed, 16 Oct 2019 14:50:32 -0700 Message-Id: <20191016214826.444202726@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214805.727399379@linuxfoundation.org> References: <20191016214805.727399379@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;