Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp235881pxx; Wed, 28 Oct 2020 03:41:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVMcEfd3V7ADs06sLwkCgGPgiU7I2IUFNnm8g+BuZ0i3ECTFx4X9mGydHqeNjToArzMzuK X-Received: by 2002:aa7:da13:: with SMTP id r19mr7039105eds.20.1603881682256; Wed, 28 Oct 2020 03:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881682; cv=none; d=google.com; s=arc-20160816; b=BA7GBwymxW04L7nC9zUwfYqnrPipUrag1P5eo3c+fj5ieRzvwscpwWwjrvdhQ796wy NsJ9xg0C8tN1NSXp0JHzOtubb1QrMgR4mSXSLz2gMb/pBZWQBjjY1ufvjV3DVmYHfedq WPBFfYFfJBxTQuDNZR1hlceHE0tjJIdE6Jmnn0Q3ufhwjKZkpUZ4ZwZWh8Kuk0/wWZei Bwxv5v5jyf+1lLipRHYIOsIeU+1Nsd3er/w3VnFJgEa49ooowsSfTT7i5BfEfYMOt/QJ 7LjNMEKe9Co+r0ZRE7IqsDoWomlkURs40NrRAGrnzIcogIgT4ayTBcNMbqufPASWFcXX si4Q== 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=itDX3t01GTPS95G8p/yVOy2tdqc8KjMATxuBi22pS5ZjkCXKWUARRcKTg8VzvAlult ICmb40qi53iq7e3CuZHPa+T3lKxxOhQhXyMWpl6gMUlUmNFnljnD+Kk0BOypJ9mg53Wc RJNOmVZvCT4DbPuFjGxiP4Q+3gxa2rhUNK2FLSuXy5mBkvT33Q4lgSBuZ4UHGxh1H1/9 rtKdxKtOLQvI5hCsaUkZshGmffXvPBX/XKlKPG/2kcZ5agzYyLfgPMfwMsr/zMFaBMFn H/5twPRE/vbY3uArxsIPxLZ4AvFLMze+Pqa2VPm0BdASRDwddxIKnDc9D/oxCBg2d9nj c3rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yFKAWSgV; 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 s16si2897729edy.300.2020.10.28.03.41.00; Wed, 28 Oct 2020 03:41:22 -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=yFKAWSgV; 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 S1763619AbgJ0Oor (ORCPT + 99 others); Tue, 27 Oct 2020 10:44:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762647AbgJ0Onv (ORCPT ); Tue, 27 Oct 2020 10:43:51 -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 1BEEE206B2; Tue, 27 Oct 2020 14:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809830; bh=pEcuukP1EntrnDVa20u60O7w1UUKqI6OwYX4e7li4o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yFKAWSgVQcTFRo9HwdoNfXpzHuCR9XUABWuFrYjQmUflrnIVBqNUm0dXRPbUZVoQc pWvoWFJ12gTuSCu5XwSaiknffdGoHP63pGYDF709Bqes2n4WU7qGBXKkKEENBGmXks wfakoWThV9sjYMZjs2rwQQ6iee14f6iU7loXoK4Q= 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.4 334/408] media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync Date: Tue, 27 Oct 2020 14:54:32 +0100 Message-Id: <20201027135510.529823544@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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