Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1094244pxx; Tue, 27 Oct 2020 08:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDm0bb8okBCa6eOzYYNHpJNKwCGYoeQeXM9d7+iCRuQhaFagnloqcgXtMBBYWcNgFgZT2M X-Received: by 2002:a17:906:2894:: with SMTP id o20mr2775025ejd.221.1603811313820; Tue, 27 Oct 2020 08:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603811313; cv=none; d=google.com; s=arc-20160816; b=lrX+CWCYH/WIRWkrFsbkSetKjZ/mqQQ4J1n8oqcf+lkY0NYnkNIiDkbpFDwn7JkSr0 lbwBycID1ltz4e7icTLk+biVcMOEBP5F402iICgfuGLnyz0mLYoqgSpnCSXQRPbEp53X Y3NA965MA5Hdi5+yC4/fRY2f4z/jqRl+sSEL0Jn1GuOo6JCHp7KZxsiKFDVJUM4Racs3 tITVZCFsCeWbEIFXIWlKYuQ0l0F4bt0cjqdG9IB0xua+WHn5ms0ZDkYtaSEsege79rbJ 2+kuArGGKSEK3+GIAtFOi3DeWL4P3A4QXj6jWQU+qWGCCfEKktw/pcILnTMmwnYVBgtH hR+A== 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=NHwSoNyYibF195KOInoVMYjQbJTmJ3bZv+IyZHUPolU=; b=PAbOk7+gC+WkTuwuX1QSEgM6dniTNRkO143rJGJBQNaCZBvWryUxeLHo7T/a5NW5Pe 95twmX31pJlRfLzu4wv1pUZBeQUQXPrcYnq3tkpQJcZ8OC/AOBxS5Gg8XV4YV0mtAiRF +4dJqF3RIUYZuRBSFErlOwM9Eb3hKqFPbGpL78F3fcXHHWSX7Wis2VNHo5C8+S5vkP0Q Zvp0iV+2KjnCuJ0h8D7UapVHn4NoDw+MtTrkzBc8E5DkXU3NEd8L6wNXRcsSLOSSEhYc xJa4GPaLnEhFax7GelSY2uFL8HjJ7LZCvnmL8TDWxcqYFtXv0XulGrQymzai0qf38L7H mamw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NLdE9q9M; 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 r26si1275055ejb.125.2020.10.27.08.08.01; Tue, 27 Oct 2020 08:08:33 -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=NLdE9q9M; 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 S1754779AbgJ0OHC (ORCPT + 99 others); Tue, 27 Oct 2020 10:07:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:47456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753430AbgJ0OAB (ORCPT ); Tue, 27 Oct 2020 10:00:01 -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 8F6CF218AC; Tue, 27 Oct 2020 14:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807201; bh=kCI6C+Rbf72dTLt4cwKxut0xt+2H3GYiFc6VgBsQ2KE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NLdE9q9MhLPJXPWxaKEe6T0Qd97i+Y1vv8HVj/2h74dSY4GNTQ+H/6QSpYhFIhmq1 jF5rrIMkriu+DFY+0XFNlmgkLARTuALXsZp2i5fHx8DMtjkeGbp8bvOBnkZeCGxidH c4BLQRoXinXo0uDGT58urk1UxL6DsIvt0qxqOqhQ= 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 079/112] media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync Date: Tue, 27 Oct 2020 14:49:49 +0100 Message-Id: <20201027134904.282305822@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 7ef64ceea0008c17e94a8a2c60c5d6d46f481996 ] 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/fimc-isp.c | 4 +++- drivers/media/platform/exynos4-is/fimc-lite.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index 5d78f5716f3b8..ad280c5258b34 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c @@ -311,8 +311,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on) if (on) { ret = pm_runtime_get_sync(&is->pdev->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put(&is->pdev->dev); return ret; + } set_bit(IS_ST_PWR_ON, &is->state); ret = fimc_is_start_firmware(is); diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index 60660c3a5de0d..65b33470a1b1b 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -487,7 +487,7 @@ static int fimc_lite_open(struct file *file) set_bit(ST_FLITE_IN_USE, &fimc->state); ret = pm_runtime_get_sync(&fimc->pdev->dev); if (ret < 0) - goto unlock; + goto err_pm; ret = v4l2_fh_open(file); if (ret < 0) -- 2.25.1