Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472882pxj; Mon, 10 May 2021 03:58:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeBXDfQaMfclnpckHiQLb99K5l5Y0wm/r/UNgNtwgDkoIZeoGSgjnQAe31nkL5PD0Poqmn X-Received: by 2002:a17:906:564f:: with SMTP id v15mr24457828ejr.96.1620644288102; Mon, 10 May 2021 03:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644288; cv=none; d=google.com; s=arc-20160816; b=wg2uFz7BYccoKKfBOcHwNEGD11aaABOFiujno8OfSUrv78TNtgYOF9cHTZayONHAKJ U9jWnE1ZTwdR0X+di6wFJNmsXBZqCM2HP9bDTzrxB4xqrwl+Pn5WgW37j48uYpHh7wUI TvO6KYfOittrkiWyhnSuqlv56F+SowFJW144sDN3y7zVrsnuy7BGbPe72ZY3FUyJslvf t4B5WVnjQW1ak2Y1eEzb8GIlwTB7+WzfZuVs3CIYuvrKSA80qtw3k4vQ2Oxa7hemHR0+ mS4b4/b/BgAHFjjdfdC89d2t3a2tQD1pHnp0oRz1fZiUcSLvF1JcCB2zWBTg74nWrcxc CHQA== 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=pXYsS8WoMAIXGnk7+FStZvghCa3MSPQgWcuGwH7Y3BE=; b=v6toNutvH4lOv+RbcC3KAJpWVBfMm8cj3VqPN1NsfI94iVMN9LdM2D4Mu7jiUywO8b iKUAcI0597+jK064qxJhV7RqZDPElE0GzWJDXgfFXqqMuHvc9LEFSR0yJmv5BSeL++jy qLGhgE6bPDby+ywoBFQqCplPBtHp7VxsONC0JQdHnHzGzvXEbaNRMfZGcE9W9n+04ZKI RXYJ9dPqBFns0Ohjcumhgey489/zPrJ7vKWW0c8bIaLcJ8LhI13+prElOiXmdorxyNBq stVaQtUEEDsCG2N3j9mE0yTz/pIeq5lJ7WsUjHQ4303+t9MlpixEYZTh642PD1IvEh3g 2AoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d3J1fMPK; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c17si13531824ede.337.2021.05.10.03.57.43; Mon, 10 May 2021 03:58:08 -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=@linuxfoundation.org header.s=korg header.b=d3J1fMPK; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235010AbhEJK51 (ORCPT + 99 others); Mon, 10 May 2021 06:57:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:59362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233137AbhEJKpO (ORCPT ); Mon, 10 May 2021 06:45:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF165610A7; Mon, 10 May 2021 10:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642897; bh=b2fjkCROhr0YWwuGxWZG7T4CbPA4ai5XCr36IorCXKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d3J1fMPKnSVOaW68UaW67i8wkDjTJUYxS4K0I/DhnThtfGLrjzLGFu09UwsH27JTx ++4/nnaXIVogDjACS5gX2bphqN6L3jsJFI9dKxc3C2Zmp4Ftvx5XVtDAQO/RUkfDUV BVLS0H/kOrwYyLdV2+skgDVSca0kaIl0EGVfmNKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Bixuan Cui , Sasha Levin Subject: [PATCH 5.10 097/299] usb: core: hub: Fix PM reference leak in usb_port_resume() Date: Mon, 10 May 2021 12:18:14 +0200 Message-Id: <20210510102008.142316032@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bixuan Cui [ Upstream commit 025f97d188006eeee4417bb475a6878d1e0eed3f ] 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 Signed-off-by: Bixuan Cui Link: https://lore.kernel.org/r/20210408130831.56239-1-cuibixuan@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/core/hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 17202b2ee063..22a86ae4f639 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3555,7 +3555,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) u16 portchange, portstatus; if (!test_and_set_bit(port1, hub->child_usage_bits)) { - status = pm_runtime_get_sync(&port_dev->dev); + status = pm_runtime_resume_and_get(&port_dev->dev); if (status < 0) { dev_dbg(&udev->dev, "can't resume usb port, status %d\n", status); -- 2.30.2