Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp174804pxx; Wed, 28 Oct 2020 01:37:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHADsXxjGln6l0Q9UZ1BcLQBfTSMOwko4uiegUbGg/RVZ6g0pEIw+UlQnQK8TcYdkbe9id X-Received: by 2002:a17:906:804:: with SMTP id e4mr6653667ejd.379.1603874258485; Wed, 28 Oct 2020 01:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874258; cv=none; d=google.com; s=arc-20160816; b=VjZvByLD913pD6DiuhneUWT4LHMyDQFci+syQd4Qz0QxvMfzOkUuuZ1BNBxHi7rcW7 BB4aplHtdstIWxXMXEj8hKM9NoLGW6nCYhaN21nRZrQGfembt0Ty+MK2Af5MawPjxKy0 AfVM5KYzRi2FFr20Ht5fLNAjJU8ka9vaM/6Gwh42l6aNolEyl+PtUtev6XPFSqVIwz2d FcS5kpscFhtHKrMG2mtV+91eqqoxhthEdgc+DuxbkIz9WVRaTJzliJ1sGwS3UoA1y9ZH xXsgH2aZdjUePVFQ1v7iKapYk3Z0XV/Jnt86QATmhoEjRDJ0lm8eJiVhT0plgE9UiESE N0FQ== 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=T0IBqOq/F9EAF+Rusa6p+ab5yFmib9iWJg6UMQupVKg=; b=birI5a4z9aJdzrPu8Z/FwPTr6BUyVtJhKv4Sk5lTxhzVQQaiHdomVApgZ/cMxjRuOd f6ak84jZ9UpWOpmBsjCmRmpNZmwYog7RqO+BdMXvQNUfYaVtNAtHsZAhioWc2aIz2usu AhJC72zCs5nd0HcmDd/qAPrDOQKqPJHKuTBqwwkqUecbIQkZdNgOL0T//XjQZLElfYwh EJlNr29nm35L/KDL9o3LDfantdhXkgNUFpS1PrFfktQUA9VFI2IfLcIuEiZvb/m1mHXk RgRNLj0AXa6NufEyKB2vD6naiXECH6x6tosL+xR7QLn8FFHfIh1U/npG+gThktTKMVCc KrEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n5Qh03zb; 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 dk22si2709939edb.258.2020.10.28.01.37.16; Wed, 28 Oct 2020 01:37:38 -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=n5Qh03zb; 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 S1754804AbgJ0OHJ (ORCPT + 99 others); Tue, 27 Oct 2020 10:07:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:47524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753504AbgJ0OAE (ORCPT ); Tue, 27 Oct 2020 10:00:04 -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 0486B2068D; Tue, 27 Oct 2020 14:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807203; bh=TwfzrLa7gbwAKPwsbcBaM7/hmtaKiul56iB3GRtoZho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5Qh03zbBuHwSAts8sq+ef86/e74wB/6bS/Q+KuWXhnd0e2kwZeaLiI0Mz/Z9oLEK 3W3L+hQjvmwNv8Sg82nZ3kEVtYWPUfAT8j5o5sBGMXh4+7uZ3MRszXoXcyiB2eI3bw mvzk1LsiQJU/2UoaXapseHuW/LNp97p+ewKHlfPQ= 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.4 080/112] media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync Date: Tue, 27 Oct 2020 14:49:50 +0100 Message-Id: <20201027134904.329464625@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@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 6bc3c8a2e1443..76fadd3e3ada2 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -413,8 +413,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