From patchwork Tue Oct 1 08:49:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11168255 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D846115AB for ; Tue, 1 Oct 2019 08:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B803E21906 for ; Tue, 1 Oct 2019 08:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569919777; bh=0Y9od/Xaix3jHzilBybhBK5naiOf+CJf1Jx/MdiBi8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DIEjWOLhPuBT1/EB+NPy0ZyNnXAOw9nGt/R1gekd6dCLu8pL9H2Kuh7eBLyICmmnn Cd4qRHK7KjDbAN8ML8PA+dC9uFFszm3mV4Wrd883l4x1QVr+yeyi5WfKrodH9T1OxF X90F9orq9iFonfs5rPEJ3Ny3fZXGz8Q0c6nnbv94= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733160AbfJAItU (ORCPT ); Tue, 1 Oct 2019 04:49:20 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39461 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbfJAItU (ORCPT ); Tue, 1 Oct 2019 04:49:20 -0400 Received: by mail-lf1-f68.google.com with SMTP id 72so9202519lfh.6; Tue, 01 Oct 2019 01:49:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GJ9elSXqU+FEADEgqKR4gEl+Ure805NrXlSWROzp6QU=; b=hANb21mNdt/EfTmEGyIYn4vLkIV/yHjVMC5IRDSWGV0URpn5/4YuyIEhYZWLfuBL6n hMAOZr/M/hFbJZneee2znlMbAT1dR07zS7t2pf0QI76RmYrc4+dp3JsLX9IBeDyp4iTD eLjlkFmrRFR7M3qCelWGB/1EDgFloCZFidLbtKuYtM/4q2Vnc01dJqBjaJf21F/4ci3h AmKMFq8aI0x3e9uK/KgNBaOhaqg2x2OzskbypX+kzBUPY60GAjjIEXirRvutsp1WzXyq nhNd48OGfao70wwpAINS7z+5Cjg3Yy8oHnWZFgG5UgVbOVDHJFLSQv8F9bOcZU/2+BHz nJIg== X-Gm-Message-State: APjAAAWpuYWEmd1W++A5iYkpJ2ckwYJrHJcPQQP3n9RarU89+Md58iiM KSNH0IRWvYR6MmEUSgAMYeA= X-Google-Smtp-Source: APXvYqzpmlHcQ1I3SMZsdyGGi8W29HLhdWsD8+Be1YOiT6bLLzFd7vWfeqqd4FprTJvF75qsnEEDtw== X-Received: by 2002:a19:beca:: with SMTP id o193mr14591632lff.137.1569919758012; Tue, 01 Oct 2019 01:49:18 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id y206sm3625847lfc.6.2019.10.01.01.49.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 01:49:16 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iFDqX-0000X9-3S; Tue, 01 Oct 2019 10:49:25 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH v2 1/4] USB: usb-skeleton: fix runtime PM after driver unbind Date: Tue, 1 Oct 2019 10:49:05 +0200 Message-Id: <20191001084908.2003-2-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191001084908.2003-1-johan@kernel.org> References: <20191001084908.2003-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- drivers/usb/usb-skeleton.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index c31d17d05810..8001d6384c73 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -73,6 +73,7 @@ static void skel_delete(struct kref *kref) struct usb_skel *dev = to_skel_dev(kref); usb_free_urb(dev->bulk_in_urb); + usb_put_intf(dev->interface); usb_put_dev(dev->udev); kfree(dev->bulk_in_buffer); kfree(dev); @@ -124,10 +125,7 @@ static int skel_release(struct inode *inode, struct file *file) return -ENODEV; /* allow the device to be autosuspended */ - mutex_lock(&dev->io_mutex); - if (dev->interface) - usb_autopm_put_interface(dev->interface); - mutex_unlock(&dev->io_mutex); + usb_autopm_put_interface(dev->interface); /* decrement the count on our device */ kref_put(&dev->kref, skel_delete); @@ -507,7 +505,7 @@ static int skel_probe(struct usb_interface *interface, init_waitqueue_head(&dev->bulk_in_wait); dev->udev = usb_get_dev(interface_to_usbdev(interface)); - dev->interface = interface; + dev->interface = usb_get_intf(interface); /* set up the endpoint information */ /* use only the first bulk-in and bulk-out endpoints */ From patchwork Tue Oct 1 08:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11168249 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0C0915AB for ; Tue, 1 Oct 2019 08:49:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9009E21906 for ; Tue, 1 Oct 2019 08:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569919772; bh=Y6bBCAhnoN+oQaM/xasUAOl9f9CxTcwf2xIOYgxYlZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ckW1QWCuJkKaxxrUoR236/Zja1tBSg7qiqolMn2hGQL20dab0/+yH7FK+AFvdbBAb cqJivQwe212wnZYpfMp46cthfnDWBD+UljlwiPEw3if4qiI5pcQlOKrqL0lDdYWoOK Vw/A/L5vd4uX/q4yWNbyw9HGiD+/H78wzjX22y3w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733184AbfJAItW (ORCPT ); Tue, 1 Oct 2019 04:49:22 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33175 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbfJAItV (ORCPT ); Tue, 1 Oct 2019 04:49:21 -0400 Received: by mail-lj1-f196.google.com with SMTP id a22so12467126ljd.0; Tue, 01 Oct 2019 01:49:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JUd78FTTvuyVB+HT3mJkVtnKhl3dv/ZLiCCH/pdhHmA=; b=OKICGYx3cZG1VILkvNJkl0RPCd40LJtWcrwuEI09BmKfyqaghPLqP6RG097l6ATm/h bT4KbAMg3QFdbklRp4NC5xGe1YNYnHqiMo96qfeMkmJHGMc3IHBrgq43aQffpgapUo2J +RrzKFowTkOR90+vjF8dCg7LPz3GhdY2Af96tBDv5cxve8qtXV+9v/Q5/rPpLBRk8hbN t/WhNly0hMDOwX131SQ84tlLWxO73lZIFiRx7V/NK4cSZLgjtPK+EVvPmb7GR9o1Jd3i glUSBjdFieHcdAB/XEneNsCRfX/TefWatMBXU37FfB54tycdvy59E1mZYl/vMCdE4MZJ iJgg== X-Gm-Message-State: APjAAAV2FKo738iLMp8CFC0JPV+P84f21ieYl2BKpmgVWHIQtImFgX1F L6UWV01dJ4H5LY/XQJw+suc= X-Google-Smtp-Source: APXvYqzyk9KKiUwbpuHhcejhs2Rq0Ta8oGoO3n74kd2chyGPqAjezkB5yhUJ0pgt0iWxKZLBwVwj6w== X-Received: by 2002:a2e:7a16:: with SMTP id v22mr4690114ljc.61.1569919758982; Tue, 01 Oct 2019 01:49:18 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id n2sm3860473ljj.30.2019.10.01.01.49.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 01:49:16 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iFDqX-0000XE-68; Tue, 01 Oct 2019 10:49:25 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH v2 2/4] USB: usblp: fix runtime PM after driver unbind Date: Tue, 1 Oct 2019 10:49:06 +0200 Message-Id: <20191001084908.2003-3-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191001084908.2003-1-johan@kernel.org> References: <20191001084908.2003-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- drivers/usb/class/usblp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 7fea4999d352..fb8bd60c83f4 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -461,10 +461,12 @@ static int usblp_release(struct inode *inode, struct file *file) 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; From patchwork Tue Oct 1 08:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11168251 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33FBC15AB for ; Tue, 1 Oct 2019 08:49:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0FDDF21906 for ; Tue, 1 Oct 2019 08:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569919774; bh=KelDtzYRHwDrGpc6YZP7ah7SpzPtAxZHrph0WJmy4fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sgs4dMNA403oCkdmUaY3Ey3cCSVzAg+19/+whZAPbfmbgm9u8VkCzX6IAMO3dpU9J pPBuRNwawkW9P51m7cQVDECXqouiKzKn/l13eqLX7w20L3JluHOJb9WzxWVbQPpTOV sjz8+16w86EnmccktcyTQTI4dGtKPziqt4fnfINg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733176AbfJAItW (ORCPT ); Tue, 1 Oct 2019 04:49:22 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36397 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbfJAItV (ORCPT ); Tue, 1 Oct 2019 04:49:21 -0400 Received: by mail-lj1-f194.google.com with SMTP id v24so12455239ljj.3; Tue, 01 Oct 2019 01:49:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gEnKuOgkKrLviOK0l9N8El4AVdrpE1iBgXB7qlP+GeQ=; b=srG7yudlO8VkBtzbNIoEmKFFBpOvbwD548Ek4AgYw+Im78BMM8rY/v9HPNL7bb+yKU rrClyCIsgza0T6aTdw4tagaiNElTrV1VKe8LGnnLWEkIyIic3ypzs09udhCJeNvu/Xib OUjfG+8YbnTs93euDYpr0I+dzEkGOQkSHw7FCKA4tPU6SRmIqlYZH1CVMAo48NLZezys 3EKlF/Lkc4/ca9SUu0qrcX7Im4jvnHH44qVb324ToVCdsuz08/mOxvdUt+zpDWTNw1uc ujRH8WUZ1IXQwDCNMJEpeszZvVKzi9sQWAcF/mJXY+dH4IfGiyeBoVg1qeWdPuQ7yCsj /icg== X-Gm-Message-State: APjAAAUu3NXguTmwEdbiFcKDNAR1hv6v7ULx+gsrwKPO1OyeA99qSFn5 jrAxs76v10qcHiEUjCgY6Elx70N3 X-Google-Smtp-Source: APXvYqwNmxwDPfKwLfU3tI2fm/OOm/SmdNhB6Ir+FYReLs4k/zz841y6msaT/KEz9vT5NStVRqQyJg== X-Received: by 2002:a2e:1409:: with SMTP id u9mr15376750ljd.162.1569919759420; Tue, 01 Oct 2019 01:49:19 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id l5sm3710079lfk.17.2019.10.01.01.49.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 01:49:16 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iFDqX-0000XJ-8f; Tue, 01 Oct 2019 10:49:25 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH v2 3/4] USB: serial: fix runtime PM after driver unbind Date: Tue, 1 Oct 2019 10:49:07 +0200 Message-Id: <20191001084908.2003-4-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191001084908.2003-1-johan@kernel.org> References: <20191001084908.2003-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- drivers/usb/serial/usb-serial.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a3179fea38c8..8f066bb55d7d 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -314,10 +314,7 @@ static void serial_cleanup(struct tty_struct *tty) serial = port->serial; owner = serial->type->driver.owner; - mutex_lock(&serial->disc_mutex); - if (!serial->disconnected) - usb_autopm_put_interface(serial->interface); - mutex_unlock(&serial->disc_mutex); + usb_autopm_put_interface(serial->interface); usb_serial_put(serial); module_put(owner); From patchwork Tue Oct 1 08:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11168245 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3F3813BD for ; Tue, 1 Oct 2019 08:49:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D24D921906 for ; Tue, 1 Oct 2019 08:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569919771; bh=dsarGCswgx7ic5yApssoOVQt7STf0OL5uaDHkr1jQws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ph8D6HQmVqRHV5Lt4zAyMk1ymXe9vLuYk9vl6hxJlujviHlmGdAcXwUJGGoHh3F06 IzdOq7X0vGGMbCDk0yxPTc9myYMmc3GeAeZmPQ+S/jyADlrQRwctCmnnrMebYHKjdf A8PR1WLW1n6h7BSqXHscSlXeaHk5NF2a/oWgbylc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733190AbfJAItX (ORCPT ); Tue, 1 Oct 2019 04:49:23 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44381 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733162AbfJAItW (ORCPT ); Tue, 1 Oct 2019 04:49:22 -0400 Received: by mail-lj1-f196.google.com with SMTP id m13so12409800ljj.11; Tue, 01 Oct 2019 01:49:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ca/INmDFVsC6VnPl4lbuo+UeGmswEkRdIM5NeHHd3ug=; b=Ww2Ryi3ltsDgPMrNrUxlUd1YCrtKo4JXAq66jwhEe5NhT3hH6bvP3PCNYNTXWWH/km rnASuR5wZ/e7lFdrzlwDbZwYGPdCB1pLom4PU5IGqCn0HUOzyhRoNuFZ3zS1Qv1Q0BlI OubmPXEvOAjpE2tmNxkggcT8p1DJPrSJ1bMKcXjdACiBJJFLIThbGNKqPbrIOjgdiSS8 LLDdlphbJv0NC6KwYkn9T4+FhtqkWLBm8pMy78ACj4K7jpypqmXY02NCz7ip5kgwuByZ 5odw/nPiZojdsFm7CCzljDuNapnvdx7u9/whkX0NFc8gNnqDp5VBYs2YZfzyCKKpQvKR /Wlw== X-Gm-Message-State: APjAAAVQRnLGLiV7f6pH4I/zY1gt915BUquHgIQDjPfyMusTTv2k0uYo aUCRfvfq32JcZqMNBFnp6Jk= X-Google-Smtp-Source: APXvYqx6zk0AODtqV62ey8fF5pZauaelQT9dehzN+xR3TYKKj5ckKfHYTVe4n8+ixmC52JRbSN1mxQ== X-Received: by 2002:a2e:4296:: with SMTP id h22mr15418860ljf.208.1569919760229; Tue, 01 Oct 2019 01:49:20 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id h12sm3880087ljg.24.2019.10.01.01.49.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 01:49:18 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iFDqX-0000XP-BP; Tue, 01 Oct 2019 10:49:25 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Mauro Carvalho Chehab Subject: [PATCH v2 4/4] media: stkwebcam: fix runtime PM after driver unbind Date: Tue, 1 Oct 2019 10:49:08 +0200 Message-Id: <20191001084908.2003-5-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191001084908.2003-1-johan@kernel.org> References: <20191001084908.2003-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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. Note that runtime PM has never actually been enabled for this driver since the support_autosuspend flag in its usb_driver struct is not set. Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") Cc: stable Acked-by: Mauro Carvalho Chehab Signed-off-by: Johan Hovold --- drivers/media/usb/stkwebcam/stk-webcam.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index be8041e3e6b8..b0cfa4c1f8cc 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -643,8 +643,7 @@ static int v4l_stk_release(struct file *fp) dev->owner = NULL; } - if (is_present(dev)) - usb_autopm_put_interface(dev->interface); + usb_autopm_put_interface(dev->interface); mutex_unlock(&dev->lock); return v4l2_fh_release(fp); }