Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp174350pxx; Wed, 28 Oct 2020 01:36:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlTY/gkRAwmNkZ7GfsLHsKJeYUYAr86dZwS38xzv8wfT1et6uodq6J/JaSOaEnsGrRY830 X-Received: by 2002:a17:906:814:: with SMTP id e20mr6785452ejd.367.1603874206731; Wed, 28 Oct 2020 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874206; cv=none; d=google.com; s=arc-20160816; b=jMamwnY8OfaZO7Kp31RMR4Kf0HECEx8oXBDcMceWPULTcgMiLWfc8luAhjXrs1ZW2e wTa8w9Z+1hiEvbhfMtYNQfF6iaGpfSk40zu/NMgBDycQk4eKUaqp1vTwPBBHAOyABDTo NifED6ncVFVzk3TeSdMvi1E7PuuTXKHt80uKnxsbM/BjyWiuTindWSD9Ycjx2wa5Pwfp HIJ3FNKRRrDlnPfgqMhhCF5a0yto5be4Fr8m0S3Wz03tkxzX+upd+PxZO+07KNOGJRKx S8PQRar0gvIbuHWHnk7SkiWbCPLuYM/QRILgtu+ONUESP/XptcF42kN9AvB68xDj6DSY 0LZg== 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=fMfog8yXNfTBDxEr5n6vxg6Hhge3zZAtEFVfydL5KzU=; b=XcrmLoNY18Bf9f5IIb5sKfI1rwKJHm9bph7Ahlt0QdxaakKaJuap6/ZkGCAhQHYpsj xH1L8MJjeEBoAtUQYaHVaJGDjCF7Tk5qRkvONyWOXaDCx9Aha10P2Q5I4NISlPQlw9MP 9jDi0WdlRnDzDdfwpZq4EKG1OmB/M8vzEUIa/P9qBtUct1+kQqvvjXaARwwRhHCNM1f4 xzbUCoiXUCOdw0kSAOQ4JHOgIKoB0WR7r1xFJNlAQCU1KmAk0NM6PkxzQ18zk3YoRinn u9uaXumODk91WwbAJxTAhZr/bIhD1hCQ9Z4K3cgq8a7KIgSAehJDqJoVCnWDhRdHuF9t CuPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MrtazzhK; 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 d4si2698178edr.173.2020.10.28.01.36.24; Wed, 28 Oct 2020 01:36:46 -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=MrtazzhK; 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 S1754374AbgJ0OGa (ORCPT + 99 others); Tue, 27 Oct 2020 10:06:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:54786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754656AbgJ0OGY (ORCPT ); Tue, 27 Oct 2020 10:06:24 -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 E334922263; Tue, 27 Oct 2020 14:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807583; bh=YeQjeH3b9F8vLj6Aufdb8iLXHW9AtAaW5xapCFoZass=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrtazzhK1aFv0mPGmHkBva4dX9fyQCOCSZQ6ipPKa0Vt5oP1ReqaYPJhf1b3vaVd8 1oiDSuqV9ETS4RbbMVOlyoFh/C/NR7G0OISf2/b6Hy6McrLV0hjaODBa6w0tgLziGZ WaGS/8JoJtWe2mQ2Q3PR0nROqef/v4C0OAT2hROI= 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 098/139] media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync Date: Tue, 27 Oct 2020 14:49:52 +0100 Message-Id: <20201027134906.790973564@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 c47f7c779ef0458a58583f00c9ed71b7f5a4d0a2 ] On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error. 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/media-dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 532b7cd361dc8..a1599659b88ba 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -477,8 +477,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) return -ENXIO; ret = pm_runtime_get_sync(fmd->pmf); - if (ret < 0) + if (ret < 0) { + pm_runtime_put(fmd->pmf); return ret; + } fmd->num_sensors = 0; -- 2.25.1