Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1084239ybt; Wed, 1 Jul 2020 18:28:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLZ08SDYOfOjdnzRXk3yE2feMkh1WxahiWIclOyfIimkoiw2TDx9GMvNZ/OBQOnKe2vzpy X-Received: by 2002:a17:907:1190:: with SMTP id uz16mr25083580ejb.385.1593653310037; Wed, 01 Jul 2020 18:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593653310; cv=none; d=google.com; s=arc-20160816; b=wtpguCFFMj6wh69Lnx3XfKSoTupLnKqh7WaiVx41tbUA4+9LU7exdArecBhTZa5BJV 54eyk0lkveTUncf/xOgmpTCppIon1UAIuEVJic1JhkxU1liVdjOwdP3ZQNZU2fKMLKEW Qfi0vwmblJBzQZqBmN3TC/sLTcy2IKaoeSlBAbDlNn3LlLXwqzTFfhpsHgOqARVKAbrI o3A4z5muLrpMXh3Jm/PYIyfLMbYssXuhXkqPv5HOKoY0HzgM2JEzu71r3u+wfmG4q7G6 Sw2Q7Bndhwjzy9GHjVqiXrgL/NTWTrpPGkabFPdmJPqjCW02R1mX1TkQjp/TMIs+jFuJ YDIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B/fRNesjj95Y8vv6H0lavT+yLbz3OJIZJI0JnRGaerI=; b=JWn0wa3fAa5jiEGxlIW2f8o48KM78pZ3i/BSIbGuRI54RtH+8WayXdTo1ndkyOjL6V n+5lz0cl+3sLjMcS0+INJFkwEXpf54F/P2J0hLitV9jrtb5SCq9AF2x7UJQ/IuJg+qwH eEYxh9XxLmZEhszdoOUR01QkFG2o9ZLWk1PKQYGPrmcLg5AbG0xGn8yGyz0Fv/jdy40Y yllzH8vFv78KIaeZS2eI1TsR6neu6H/BS7ml7nnnehDzRRtwiMgJMcAR3RzyPeJ0ugF4 +ut40h8QQUUvLZUyI/js3vvb440I4oXo2iNMvpmHsdcx4+BbM5vj/crbK+6TZYhHalXb nLnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f6H49pPY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ar18si4809020ejc.515.2020.07.01.18.28.07; Wed, 01 Jul 2020 18:28:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f6H49pPY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728120AbgGBBZJ (ORCPT + 99 others); Wed, 1 Jul 2020 21:25:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:54620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728497AbgGBBXu (ORCPT ); Wed, 1 Jul 2020 21:23:50 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89D8C2145D; Thu, 2 Jul 2020 01:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593653030; bh=XShLMHFLIslsFzvvnDfxIF44y2nXE8NLb7s1NS6Wa0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6H49pPYM2bRb3F2x0OvH64m9Yksals2JLqrwueVggA3ug3oma9zyM2sLMmB4QF4U JscLPHKDQYx4NB5/wPjPBjE6MjcSipR3uJjLhO5yHA6Uld1/ofKFR/fQxoYNMSJumw NztWJIPuzMyu5DXsGJPe0J3hPvCFXwz4WRmoG5jI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Aditya Pakki , Felipe Balbi , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 44/53] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work Date: Wed, 1 Jul 2020 21:21:53 -0400 Message-Id: <20200702012202.2700645-44-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aditya Pakki [ Upstream commit 2655971ad4b34e97dd921df16bb0b08db9449df7 ] dwc3_pci_resume_work() calls pm_runtime_get_sync() that increments the reference counter. In case of failure, decrement the reference before returning. Signed-off-by: Aditya Pakki Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc3/dwc3-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index b67372737dc9b..96c05b121fac8 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -206,8 +206,10 @@ static void dwc3_pci_resume_work(struct work_struct *work) int ret; ret = pm_runtime_get_sync(&dwc3->dev); - if (ret) + if (ret) { + pm_runtime_put_sync_autosuspend(&dwc3->dev); return; + } pm_runtime_mark_last_busy(&dwc3->dev); pm_runtime_put_sync_autosuspend(&dwc3->dev); -- 2.25.1