Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp235121pxx; Wed, 28 Oct 2020 03:39:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqIl38PbIiu4aMtm0nPpMJpVyc54mxz+OxISzdFIxVfCeifAObxxOzXM68ri40ZpMtKx+X X-Received: by 2002:a50:8a02:: with SMTP id i2mr7245290edi.40.1603881595903; Wed, 28 Oct 2020 03:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881595; cv=none; d=google.com; s=arc-20160816; b=k+LSbGMDCSd9Zj89FpAz186QcDmRoPgOg9KWIwxVFdqkrIW6tZjOjgINCiXMD1hvj1 VF1+fFuFptoDMHRGx79zSnams0CGMNPDRomkMTlWig3OslYKACiU5LjIfB4Rd/zCrTXR Kh3e6aBqnopqrZEQGpzM7qrWjc3RBEnCAzDIPL6Rm4TPH3I37iO/NYyQWzNculh/6k8d CY7s6SwSaiJAzm2qBHqgDaDFS5V4ndVwMxg05GeT1OAg0waLDnjALRWPVl5o4N16dySy lWMguaMhX+DNKIib206X7OouexF0yOcO9E6JKZdGBCuI+nMWrPkG+mFHfnPqdZ996gqd DXlQ== 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=YVaoNS5lMbQYhGJf1652g9m+8Ir3F6jeHyRdocKgiEBMBRZOg8xMmKvJ/zVySzH+xb XZ4NrxMCYBfL0gbkP+RPreJzIX0ps9psldO26zG/ND8TlSxssEB8MLQV7lmp8CA4Gsf9 0BOU19nnG4mpb03H8m0X6naLH6Im7CDtcbxJRcfN8SPN7x7nvOhVltcd1MpB7J6Uu2Tf s+bJr4pnpcw7R9L557cS+taDOmkEzubRymPS+g8AZ7FM0CR1E3bnsgW5m1IIFX0vmCkQ 4NFg3VyWk8fqw0zvOmqZdQuuYQQFrdm9DfxclyGqfQ8ibHsG1ETmivKE2njzw0ybdewJ 8JRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uNv5ETPF; 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 p90si2749641edd.284.2020.10.28.03.39.34; Wed, 28 Oct 2020 03:39:55 -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=uNv5ETPF; 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 S1763653AbgJ0Oor (ORCPT + 99 others); Tue, 27 Oct 2020 10:44:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2899694AbgJ0Onx (ORCPT ); Tue, 27 Oct 2020 10:43:53 -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 DA3A9206E5; Tue, 27 Oct 2020 14:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809833; bh=0w6BHfgMrYO94w2zhJG9aBTMWbnKGy674ULRy3rSaVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uNv5ETPFiXO/sbPNxxkidvNMobPtALymZ19kl86yWKoKcJweUwk0H9ZaVQKGLnaev UKEvb9y3biiqoUl4yBYhOep8Y8B+hadcfsksHiM7baWy66+WsLleElGMhBofSC1NBm 2OF0g/Nu/+o8FT5ybB2gPQ2gNYbtoNSuwyzDr/fo= 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.4 335/408] media: exynos4-is: Fix a reference count leak Date: Tue, 27 Oct 2020 14:54:33 +0100 Message-Id: <20201027135510.579752148@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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