Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13955157pxu; Mon, 4 Jan 2021 08:55:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5goWc9BLgTVLBoHyZ5rIlB7xuouv09wFXXva/WHH0tBI5tTwkI986gO3x9HrDOb9dlCib X-Received: by 2002:a17:906:391b:: with SMTP id f27mr65209359eje.195.1609779316489; Mon, 04 Jan 2021 08:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609779316; cv=none; d=google.com; s=arc-20160816; b=kQqU+l9lu1YcKVJeSWou3elEjR1nzU1v/hWI/fWUQfM3qt5A/y91g6ZWDgNVrld+9T uSbMhuqKw9mJOKwUH5neKuaX1bZ2eR+nQBk+FfYDIrIWhuzYy7yM0LxHBTjrRARdu9RN 5izddYO4Y83hgVGd7/1YT+ufsIRUsuEGRaYuM5tf40OPuopTZ8BR2PcXo/C3z9jyT/I8 X9spkAMS71+qaaW0QG5R47LDX6mw71Ko24BrM8tLShDY1U3zM2PVtDFbnR4PxcSXjWFe YAnbvasZo3T0d6n0STTpC8XiDt0GmSIb53adHI1vlWepfVOw/mvNS6vj9MPDOyGcQZnI IUxg== 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=gkluYJsGYfV1ZrvFA8pqqZIdw9Ze/SUmexoyVjF6YTM=; b=Xm0v3bmcfPCGzWwTn84+p2b7YVy0fyIMuHYSQ5l6aN/dr9kKo7M8npC++uHOMz8/HO iN1USmjoSjc+Lkb0it42ywpKaHGvPRQYjhSynFUXxUyKmnSlYBujedra+AdIw6JqcdBR 3Fm7ofVQU3igftks5xW9zqgi3C80wncirC5M483Naa9yC8Cx/23ROXtcgNZylK+JNNpt Dxe9fs0CeX6nsqG9MwiuWz3Z3yS91+fdbsvM2RaJBoX+LzWRegFdpBA7KGEfkJu58hmu CIWiyLabhXKIiWLvVObyBnfo3dwL0ImsFMQDYWiphAkDURqiJWNLtPFZ95zC1bSGwvRV fXmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CjngF34I; 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 s13si28186365eju.603.2021.01.04.08.54.51; Mon, 04 Jan 2021 08:55:16 -0800 (PST) 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=CjngF34I; 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 S1728366AbhADQDc (ORCPT + 99 others); Mon, 4 Jan 2021 11:03:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:40842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728320AbhADQDZ (ORCPT ); Mon, 4 Jan 2021 11:03:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4688C2250E; Mon, 4 Jan 2021 16:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609776164; bh=TYS9CyxV609M0wdg5tRs0/P/rV4X+CfCd2orivUlb5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjngF34IKOpbM9R7ifqKX7/ZvroE1fM2eO9hJK6J0CpZxZuljy9Bgs5/AnFvYiVdP Fgc5LTm5iWLtoSlG3rBw5sxpPn+RVg+bmFU6O+0J/UWreJI4V41+wprbySMUv6fbNb jwpwp/OpQZNMItjcRGfVJLOEW0aqfaccx9BLTyq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.10 51/63] watchdog: rti-wdt: fix reference leak in rti_wdt_probe Date: Mon, 4 Jan 2021 16:57:44 +0100 Message-Id: <20210104155711.287734172@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210104155708.800470590@linuxfoundation.org> References: <20210104155708.800470590@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: Zhang Qilong [ Upstream commit 8711071e9700b67045fe5518161d63f7a03e3c9e ] pm_runtime_get_sync() will increment pm usage counter even it failed. Forgetting to call pm_runtime_put_noidle will result in reference leak in rti_wdt_probe, so we should fix it. Signed-off-by: Zhang Qilong Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20201030154909.100023-1-zhangqilong3@huawei.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/rti_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index 836319cbaca9d..359302f71f7ef 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -227,8 +227,10 @@ static int rti_wdt_probe(struct platform_device *pdev) pm_runtime_enable(dev); ret = pm_runtime_get_sync(dev); - if (ret) + if (ret) { + pm_runtime_put_noidle(dev); return dev_err_probe(dev, ret, "runtime pm failed\n"); + } platform_set_drvdata(pdev, wdt); -- 2.27.0