Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2300858iob; Thu, 5 May 2022 22:29:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf33RBaJTEYUCa/9zxaOmlzRUDr8jD8Pkv4hjapqtsKyrKNbJpssJko47yF+kq2VahcE6X X-Received: by 2002:a17:906:6a1b:b0:6f4:a9b8:e027 with SMTP id qw27-20020a1709066a1b00b006f4a9b8e027mr1435973ejc.222.1651814972183; Thu, 05 May 2022 22:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651814972; cv=none; d=google.com; s=arc-20160816; b=ngMVn0gUB8HiuzKmU/mEcka3VK3VIL3L9vScH2A3fkY5NRvG1rwjU7xSll9PtDp8iE kESlv4ovhz8yigaB5K+A9u51RPZzNkkZo3ga40f7qK9zfMy1vixk8ZpNUf3bcf9YKLXx z6B1dJAYA0X+JiQl+xCje9C6bV2FvjCdBpuh0PE9n0kszimEzWue7E05/o49/0cF9InX Mm1tsXoTmWQ31qUmuOHLjUA9zERX1gKXoT1ZK3TEC2HxyK7y6kD4lA9Qs5jgTaoQBdR5 XP8Eby9uYkXADRhpJBLNyr1MlQ1CWDbxpFGKGwFTWEWe2Hg44jV+tGNNrqE4uOaKYW4l WsYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SDqXN+SzkTRxj/wOdpg/vRUd7cXxZFMf7DH6EmEFZc4=; b=sxnZXRdYKHqeIrDbJAmz096/ppzJ/Fo4qhE5vW+1HLnOS451bexl3DIjuS/TaFSzAY 2upInDj0uKTNyQMmcDwm/WKtdjzKyLjHP66RXi4PRQo8ukgxGZ8OP+ZPmFgKyfpT2tP5 QyBHhbv93TmX2MXGTv6sJNiz9MT0ZUhQYe2eJvsggizn85KnfaeimsF13hgO1tv8N067 xImadUi/Qb9k6MiosQBGqLOMOnJ0sQLuRVRNeeVOqPspwNovgrqZpOJjgaGz5TsWj5ob FyXvr2NZgG1bGXH8YUIPX5vcpB9qZ8MPjlSNmrjcSoWW1U8bO0R6+dNn7CcsWBQQwWDZ sH0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r5uV13vb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id au16-20020a170907093000b006df76385e7csi3936400ejc.796.2022.05.05.22.29.08; Thu, 05 May 2022 22:29:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r5uV13vb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358148AbiEDRZk (ORCPT + 99 others); Wed, 4 May 2022 13:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354690AbiEDRDA (ORCPT ); Wed, 4 May 2022 13:03:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22324D623; Wed, 4 May 2022 09:52:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4874FB82792; Wed, 4 May 2022 16:52:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D125FC385AA; Wed, 4 May 2022 16:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683151; bh=n9Q/W/occ0bb07vn7HK5qwDHGDLUQo+K6rMhV1GBuo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5uV13vbn90VL3Rg9fXzKGvcnWouFCpl9xJJA0RqY5rDRIhcIZPamxijnYqyzfCF0 nyd0TNBpk8KMvbF27lGRpjxYIMrTkPET3N2VRGjvETy2js4Sq+LHOFrUw1uz2z6c/X vbB4peUcHIJ/Jv8SResx67KJVGh4KurxgNJUT+8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong Subject: [PATCH 5.15 008/177] usb: xhci: tegra:Fix PM usage reference leak of tegra_xusb_unpowergate_partitions Date: Wed, 4 May 2022 18:43:21 +0200 Message-Id: <20220504153054.379355158@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zhangqilong commit 8771039482d965bdc8cefd972bcabac2b76944a8 upstream. pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. We fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 41a7426d25fa ("usb: xhci: tegra: Unlink power domain devices") Cc: stable Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220319023822.145641-1-zhangqilong3@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -1034,13 +1034,13 @@ static int tegra_xusb_unpowergate_partit int rc; if (tegra->use_genpd) { - rc = pm_runtime_get_sync(tegra->genpd_dev_ss); + rc = pm_runtime_resume_and_get(tegra->genpd_dev_ss); if (rc < 0) { dev_err(dev, "failed to enable XUSB SS partition\n"); return rc; } - rc = pm_runtime_get_sync(tegra->genpd_dev_host); + rc = pm_runtime_resume_and_get(tegra->genpd_dev_host); if (rc < 0) { dev_err(dev, "failed to enable XUSB Host partition\n"); pm_runtime_put_sync(tegra->genpd_dev_ss);