Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1342957ybp; Thu, 17 Oct 2019 11:20:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5wxt8caZvVA4KF+qs/snnds/IJ74+wOKLkUmh/9hsV4sQiMQIjViqdpxnihj+C4SaKUa+ X-Received: by 2002:a05:6402:3051:: with SMTP id bu17mr5272097edb.4.1571336417306; Thu, 17 Oct 2019 11:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336417; cv=none; d=google.com; s=arc-20160816; b=jwMR9ZlnJxvp9VBehU99e+F/3Atsg3vstNN19Mi2e90eAADWFI+yrKUJfqm9a9XU/d dvUD6gL7RkJv1t1zSTDCSbqKKxehysFQvAT46xYt3A5JXflTgdFTxIfzT2QhEQ0HBLFr +WiO3zRjGrhePP8X9nDtApIj8ubJoR8M8pXDSWyHUvR04dBzYl7LX2DgZNh/oy0K/NkD MVdautRY8bB/VxSizk25uey0uI3HWUL9U+ahk5XZDBZ/WCVLBZrsEsIQlNVaSMLZ/jTV 5bDBa0UrbDJ//Kbz13ITWza8fHmV/rwsnKdzOhk8XIJpn/00biYPrIZ8x/4G6WWUKi6y 9s+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GXy98GOZsgLHy5/h8P/E2n+86y6Hw2r6q8tHwBZk84s=; b=D+idXe2VzC8G+UzRqWNtaCcczcRKqeuqZyY6m0tpzIChEO7TvVM4pjnSWVxERiirPr JEAUrt8234fCVreNQ94GBnqqcp4pkXhb/fVY7XEVqbiZ1NtX1pNEnxuF7G/MWP9pBysK h92XcfadBkk0tJrm7bwvKDJCF5AZFBxbK3BlmVoH5npFNbapZY4oOZ5pLZd0wt4l44PD o+GCczww3HHnCZB87WkaUf30f7CrM38QuaYh+5k2eKYGlK00EMZyEYzq9fSfTgh6bSlD W5Kotw3mlJHsaHgQzh0JR5xaTCS4gqJh8rrRjh4oK+17V/sp7jNxjS8RfKBZp5MvueaV lISQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vJwi8z+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x17si1818413ejw.375.2019.10.17.11.19.54; Thu, 17 Oct 2019 11:20:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vJwi8z+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404221AbfJPWAP (ORCPT + 99 others); Wed, 16 Oct 2019 18:00:15 -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;