Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp182249pxx; Wed, 28 Oct 2020 01:56:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVnnhViAKKdSIulYl57lIV9GqKizELlXvh9ixIBIg8YSb4lze0VQD1UGKmXQ8kKeCvVu8y X-Received: by 2002:a50:eb0a:: with SMTP id y10mr6974283edp.342.1603875379028; Wed, 28 Oct 2020 01:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875379; cv=none; d=google.com; s=arc-20160816; b=LR8SGf01KxNyjKOzU4ONGc4cOfRSsqARIGjAJVSBpYWZ9l7CHUhYjl0aX+hOAbNDVr npOXpxjZ3jfa/zI5WQNVQviLyw4HDtu5GE8bfMvhWMrPcdN8WA/GxKLZuMU6secI2Smr Lt14XHuBuzuiFQi7T5gGAlxNautSAhKz/unqEofsGPLHTnAOfomD1hG50uMgHJ657sD4 qwDitz2BH2bfNF8yA0UfSeL+tqrfg3X/TaFS9cMjGMzTICZpFsrVJBI6Z/+XPsTWNXgI Q77AdYNQg2EPtki4v8TwL5i6nABUi8CsSxREuRW37If5nVMEnuGFDtW3jrJU0d6vqPJG IA5A== 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=egj4PqG2FS2S+6ezEg/WWq2vh5oKQ/OSyyb18/gHYm8=; b=NCSsRS/0Fm3//dy3d6IMJlV6PLdX720HihdWFccSVgNEHWFZAZNTZQZB6o2sdyItGo LrQy2P+0Ax4E/D11DF9AdyvViNxzGj31eUkX4ya9jRP0SN4I5yR66abWdy2ppw0Xa1f1 3qTFYOl8QP2z58br4to5RKF7HrriC/UwAGN0PrKtmNEjglw5v9nguUODJeDRMafnZt/+ y8OdCGv0x30KWj2jifFm3hu3Xjfg379VhEQd5KAKRY5rr9wGDzVTbV2YLkWUHzzV12V/ 9viCBmZxXDvOFPtZJ8cCSF0thNMph2wpoHpAWrVwb93ybFjQPUmSz/86o9b4GezZ2YvJ /xsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vGtr+23w; 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 gf17si2900638ejb.226.2020.10.28.01.55.56; Wed, 28 Oct 2020 01:56:19 -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=vGtr+23w; 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 S1756590AbgJ0OOX (ORCPT + 99 others); Tue, 27 Oct 2020 10:14:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754751AbgJ0OGx (ORCPT ); Tue, 27 Oct 2020 10:06: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 EAF1A22263; Tue, 27 Oct 2020 14:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807612; bh=qLE5NmCD35w4LiiZyJYMTASa1iYX0u+VkyhveGOJTBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGtr+23wiBcEdQQ3D8pgGvuH094QywJ0A44WeSSISFZ9narjb6VlcVZDi1CrFnnqh pS09fUR/rRHW1Y6k02Z7vZpvjI8vthUcmwV3iYvmROjlS9FKmWnjv1Poe+0WiBib7J A54hN6LJ//5WxYHzl6G6b+QSmE8cvNMnMelf/20Y= 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.9 099/139] media: exynos4-is: Fix a reference count leak Date: Tue, 27 Oct 2020 14:49:53 +0100 Message-Id: <20201027134906.839779467@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 befd9fc0adc4a..dc87c9cfa52ff 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