Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp193148pxx; Wed, 28 Oct 2020 02:18:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoTkteeDExRaSEsZ1trCv7oU0fNJm+d82GoVcFaiMwkqelJNSwXH/6W6ZqfXtwPPepK7i1 X-Received: by 2002:a17:906:6589:: with SMTP id x9mr799934ejn.350.1603876732496; Wed, 28 Oct 2020 02:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876732; cv=none; d=google.com; s=arc-20160816; b=PINQcW0qvz3hQaKv6ATnNLQRLhmrBUeY7/dzGDgayun//r3oOgPsJIpwVzYaFaeeEL zrU4PxxrMWjWdctLF3ib592Vt2SiiHH+gXcQ5zwgZNPMUMaW3xP2r/Z81gS82TEcx1Mm bBXqRYg7qBW8l8eGmZa8TUcsJFiexp3vuMmMqPJYqjkAMRUjLSU7B8gJS0klv5/sQbeX AiV9oqbbKXaRA6k+2MIU6UQ7+63RfMp+rbNlJZp3xYtCUP/pJX2LboK2pVVydb2FpxhP fYKraZeBUgueTuKcA+BwPDSMkXU8WBqvTjUgHVkXZfXG2HDPXzgrFbtXb6vV2poiBoQC S7gg== 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=wZRr6Ah1mTxM8cZsmvE33BIpYXBsBuMtkZSiEtLtZHk=; b=CcGwjPiT0ZDDWoUsFttdtZbwKKMdDlRNuOk8yQp/zZH8li+9L2KiYlJZErHDhLNtf2 Es1PCoXXGEzjdHE229jqMhGuhFbQSs+XafrY1+h7MZMnaj5YXNFSgAWEuVyKO0oFWTlw 57h06hMHD3InOylxqsrImQylczKun7hPZe7jXgCezEE/xGuaUxdmsGJ6Q4Aq2V/sKa4L IF7SXREMb/LOGN0PM7Qj/0BbAt7pkRDuSinvKB7OUiqQGgHa8xgQaxoqXtQQgtb2wyni OkWnKqonKo8kk8HqXxoLyi9Wt3OgFVR6hokRYyYLdo60LIlxup8OiuM/9WUAtmcD9DtT UZOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Al4Gp6r1; 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 g8si3473416ejm.389.2020.10.28.02.18.30; Wed, 28 Oct 2020 02:18:52 -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=Al4Gp6r1; 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 S1757336AbgJ0OSp (ORCPT + 99 others); Tue, 27 Oct 2020 10:18:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:37694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757021AbgJ0OPr (ORCPT ); Tue, 27 Oct 2020 10:15:47 -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 5350F2072D; Tue, 27 Oct 2020 14:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808146; bh=ZitSMksXbVfPgwkJze5+eHFHGlpfyn+wvp3XZE9BNfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Al4Gp6r1KIVEk3RBg+stJ3bH9N8a+K9f/5ui5/iyYvN7qvr9pS3syUWWt/13WNHxS JryPcPoWVlIQSoX0yWRgEg+oW/90DgWp0tQ1UZc1Ff3cgsy7Vx+sjQJX4MHG5wKQvW KaqzQ6+psPBF9gLb7M7vb89Ekmk0jfpV6ysA7PKE= 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 4.14 143/191] media: exynos4-is: Fix a reference count leak Date: Tue, 27 Oct 2020 14:49:58 +0100 Message-Id: <20201027134916.580623458@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 560aadabcb111..040d10df17c97 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c @@ -513,8 +513,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