Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp294485pxx; Wed, 28 Oct 2020 05:13:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZJr8zjq3OZcJzBhEKis4QCW1xqpOIDVMnOZUwBdBX5U3M3IyNz3Mv76YDCi/GdGHyr488 X-Received: by 2002:a17:906:a0cb:: with SMTP id bh11mr7526048ejb.314.1603887238103; Wed, 28 Oct 2020 05:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603887238; cv=none; d=google.com; s=arc-20160816; b=RJEsvcntma/xJhKAL4+gC3wxwkXqCjW5gKzVkAGDMEqTU09YUUtInV0opgdfov+sPv goOytWjAFfl9WHH1Bu71NTpIbijBa9+a273VgCZgVseMzbNmw+o76bVQegugmRJ/oCpo 1DIO97uRsaP+bEWs5p7ni5UnU6JE3LgrQRhwQ+u8ndNI5m4lz+ZUy3qIEE9CYkNzaCxc DXGoaZLmjso7keWpkf3ljWVtCijJkn2eOKGQ7mWCgCIPP4aO3DlhCB482yYUjucx+wdP EmA3INBy+FREkVRlYeZTCUPiRZWhr1/pPeE5NMIsSYjC32bivaeS9AE8Xg0M6OJ6RQu2 zjYQ== 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=fwEUQ5NFkvdLKplKRptCFV69nVceisqOQKeh0Hot4w4=; b=bxKQWNYzSp++ZHPIp646zXDguBWErASPTMDXcrfg6gjHfV2r0E9gYlG1orXR/9uh1b 9PowsbaZVmVaSGjBq+lXINYWTiuydYeZyEF5FyDmKpWuN50HIeVxQyoorDJ172LtLYFf 2HXBaanHhZmi1YcXuaDMgynN2pAWVZbLPjatAa5ik0yODXgo0vgpvVfS1nQO+6I1BiEU YLPMYTZlOepvvoH7Pc1N8nP+No3RD+L8tl1TDSxasMK0D6k5YXPHJRQE/X9iJRL4Ci8S 1WQDCZ48e9XpGJKOjCP8l5YGxfLp6cdnCthbWs4j+vsgSQBP3suL9aCWG4Z1aS+GkzE5 /3EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vw09uXR6; 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 o10si2705925ejr.482.2020.10.28.05.13.35; Wed, 28 Oct 2020 05:13:58 -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=Vw09uXR6; 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 S1795914AbgJ0PP1 (ORCPT + 99 others); Tue, 27 Oct 2020 11:15:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:49356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794636AbgJ0PMq (ORCPT ); Tue, 27 Oct 2020 11:12:46 -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 77B6F21D41; Tue, 27 Oct 2020 15:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811566; bh=pEcuukP1EntrnDVa20u60O7w1UUKqI6OwYX4e7li4o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vw09uXR6LuuOKVTaWb1PDrSMdnV6hyN/7ctWN3biWlj8mhF+jECLm7itIkXN+ZwrM nD/aw6G09QQ1WPo5/yEPF3Flo2gQ5dX+K3B7z+BThA8unFcoRmHrrxM3hxFMEFZ6B6 VVmFfDVqv9i+1QNDl7jFm0MGHSJPmSh5uCqqzguI= 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 5.8 538/633] media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync Date: Tue, 27 Oct 2020 14:54:41 +0100 Message-Id: <20201027135548.029375148@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 2f90607c3797d..a07d796f63df0 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -484,8 +484,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