linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Bixuan Cui <cuibixuan@huawei.com>, Hulk Robot <hulkci@huawei.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-usb@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 24/34] usb: musb: fix PM reference leak in musb_irq_work()
Date: Sun,  2 May 2021 10:04:24 -0400	[thread overview]
Message-ID: <20210502140434.2719553-24-sashal@kernel.org> (raw)
In-Reply-To: <20210502140434.2719553-1-sashal@kernel.org>

From: Bixuan Cui <cuibixuan@huawei.com>

[ Upstream commit 9535b99533904e9bc1607575aa8e9539a55435d7 ]

pm_runtime_get_sync will increment pm usage counter even it failed.
thus a pairing decrement is needed.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Link: https://lore.kernel.org/r/20210408091836.55227-1-cuibixuan@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 166f68f639c2..70ef603f7bb9 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1932,7 +1932,7 @@ static void musb_irq_work(struct work_struct *data)
 	struct musb *musb = container_of(data, struct musb, irq_work.work);
 	int error;
 
-	error = pm_runtime_get_sync(musb->controller);
+	error = pm_runtime_resume_and_get(musb->controller);
 	if (error < 0) {
 		dev_err(musb->controller, "Could not enable: %i\n", error);
 
-- 
2.30.2


  parent reply	other threads:[~2021-05-02 14:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210502140434.2719553-1-sashal@kernel.org>
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 07/34] usb: gadget: uvc: add bInterval checking for HS mode Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 08/34] usb: webcam: Invalid size of Processing Unit Descriptor Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 10/34] usb: gadget: f_uac2: validate input parameters Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 11/34] usb: gadget: f_uac1: " Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 12/34] usb: dwc3: gadget: Ignore EP queue requests during bus reset Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 13/34] usb: xhci: Fix port minor revision Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 18/34] usb: xhci-mtk: support quirk to disable usb2 lpm Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 19/34] xhci: check control context is valid before dereferencing it Sasha Levin
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 20/34] xhci: fix potential array out of bounds with several interrupters Sasha Levin
2021-05-02 14:04 ` Sasha Levin [this message]
2021-05-02 14:04 ` [PATCH AUTOSEL 5.4 25/34] usb: core: hub: Fix PM reference leak in usb_port_resume() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210502140434.2719553-24-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cuibixuan@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hulkci@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).