Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp465757pxx; Wed, 28 Oct 2020 08:59:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzghqSnyeRqGsZ5TrFRoGHEShFLxge9Cf5JJv78GHp6zMKrp6r/h4iK5TfYFBmUExJaEMR9 X-Received: by 2002:a17:906:3399:: with SMTP id v25mr7967382eja.51.1603900755311; Wed, 28 Oct 2020 08:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603900755; cv=none; d=google.com; s=arc-20160816; b=eULxqUnGVZlJrddzS9cnYhnh60N7RtcWpWGIad/Zzr++nuwaRJbZn3iPqO8rCQrY4D V8u63vGNbJjZdQYXAyUBPDwuHhdzb5aBCnFbfarytdUD/nDJUte9gh4qp5eHTqv513vu Up7yxldn+MgDZQl2tfPNlOdtxjf0j8oJGXacZSWtI2v3tQ+pjA2hd3swCR6LjQls5LTS d+AAbJNnmfF8v6/aGw5/0GWd9nMrXNiXbyC8Ri4Gu4fsLtMgPSnhbGDWxFop8SnBGFcj WyCn5Gpb5eytzLdaIp/kcdXPubEhfxgaNHIF3MnMxoBSS4px4qPZtB51OB/f+KuSgxI3 C3vA== 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=aDfOhx/FGAUB2QN40pVXVBrbreiI1OGo8tMCF17+Kbo=; b=UmvffIz03/m9mrwpHI3wstts6ErGb20xzu23u6q0Gf5dLVgemNcJX7uH640ryTDEem cFV4/3R+3mpIEAod2Dfdig0QkhdTfWYgTWo/WaIs43o+lVq3wul6/ooZYvparKvxznFR VjFJBztRFWQNJyz+CbS08rOdzX/G1hkLnCEOAIKKfmHq5OogSLpJVA75ZbEz7lt+k9XF 6t+Ryw5FUy4+7ID470AnyZ+9BvWGxxk4mZjWBjHJt/CeTtedIAPMeuPBzZj/DBG0vJpd +COAJSoBBCnkPNNkslg1eV8kr1f65JAsp4GdKy4O+/kBgfOU2Np14yzSwrX4KtBO9FFy e5Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="1gqro/PI"; 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=fail (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 b6si3402013edu.343.2020.10.28.08.58.52; Wed, 28 Oct 2020 08:59:15 -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="1gqro/PI"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1813676AbgJ0QxX (ORCPT + 99 others); Tue, 27 Oct 2020 12:53:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794645AbgJ0PMt (ORCPT ); Tue, 27 Oct 2020 11:12:49 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F96720657; Tue, 27 Oct 2020 15:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811569; bh=0w6BHfgMrYO94w2zhJG9aBTMWbnKGy674ULRy3rSaVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1gqro/PIcAhQO4N8j1l3TZBx86gdgF3Bnb01qWm/dCZGFDUSOlAuGDGkA/uLJ7FEx xeTLM9kdDqpDqzlYYpTzEZIsAZ1+0CFjSxjHl8g7taYYF867lpDggEuX/lKbjjDY3z 35cGAijkhc+0x7lD23E1CVnavdiZNXofL2cBF5bI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.8 539/633] media: exynos4-is: Fix a reference count leak Date: Tue, 27 Oct 2020 14:54:42 +0100 Message-Id: <20201027135548.077630681@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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: Qiushi Wu [ Upstream commit 64157b2cb1940449e7df2670e85781c690266588 ] pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails. Signed-off-by: Qiushi Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/exynos4-is/mipi-csis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index 540151bbf58f2..1aac167abb175 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c @@ -510,8 +510,10 @@ static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable) if (enable) { s5pcsis_clear_counters(state); ret = pm_runtime_get_sync(&state->pdev->dev); - if (ret && ret != 1) + if (ret && ret != 1) { + pm_runtime_put_noidle(&state->pdev->dev); return ret; + } } mutex_lock(&state->lock); -- 2.25.1