Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp664327ybt; Wed, 8 Jul 2020 08:45:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfzTkVDITVQoSI5IWvMVkSbYM+4BLNt+sz6A/d72ojc8jt0YEaenfTO33pVxcCgxcEA+0H X-Received: by 2002:a50:e689:: with SMTP id z9mr20191991edm.131.1594223151263; Wed, 08 Jul 2020 08:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594223151; cv=none; d=google.com; s=arc-20160816; b=vRrjI7FbkjFo6FKo4iyMXzpCn90l969wI146tKfWx3hsFqyVSVyJQ6mReYORpkIqh4 1F28KFFZeGBS8RFf/RBiBQje4qkxuhpw6b8H/F93POFVOs8/7tDKQYVWZu8lFO7T9K5/ MGSGu8kc5fEYJQtHz5CwplRNBx+XTfuesieBiXhTC2YcJfuic6mGVd+QBW/omKZ18Sl7 ND9RP+he7eaBMRNqeulfGmdc22MSt66JRBCJw8KgwV60z92vDYJ1sjoPbrxeTHm4MIKf 8iE80hA2nfiGEiWG6AKBXCkxhW00DNqP1Mv1epLSmGIehIls3uKEowW3bafYUIuc5wHj +AqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=779xmR2daEy8blDnokJ22D80gt3xiTexUbVBDKZY3GU=; b=AFWc1bfRGJmh4qrYN4UPUbTUK1f/RAiARAr9jR2AJD+rgvDTXSesz3U7p+/epUMk8O UZtlYeuddCYURmDxy0nFGyomzgEiEgbifSf9pX/j09jvKtA0t5DtVpnc5AohQGC1wOh7 Ss55VaMzQ99LWfzREW2yNtQoyyPol8CoAmOhKURDEJpXUhaOZcbC1CrmTxk2f3/gUVsG 2sEtnV6M65Eaujss0L5UOcPyx+uhIDcINWX1UvAt31ncjJ5+n+zlmtTnklIUmRA9rZWZ YZNOJIkN7fIbpfn4aXBw1QcSc7qm9GHNdlZI+k77IqFKmRDw8c8cg8T4sOMA7iVu9IGf WtxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AFotQp3o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn3si134503ejb.165.2020.07.08.08.45.28; Wed, 08 Jul 2020 08:45:51 -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=AFotQp3o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730409AbgGHPl0 (ORCPT + 99 others); Wed, 8 Jul 2020 11:41:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:47814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730395AbgGHPlY (ORCPT ); Wed, 8 Jul 2020 11:41:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5FB38206DF; Wed, 8 Jul 2020 15:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594222884; bh=LNiLAZUBeUzQmxzaDeI4EkEX9Ch+UJWdsulMeVHPu94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AFotQp3oqnVJ/P3qjSi8XENPGxD2Q1iIfStNJfl4lPJyXHt7L2UApwdqyDUXCL7qp 3crLU/dQYnDDbnXpE1cjE6AWf69D4jEaNrkUynCVJEZON8wjfL+6SOFZTH1W+SAuID Py9U7s8WC+lWWp3E0jbHiw6cpM5wz6xW/vuQFwWU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Navid Emamdoost , Inki Dae , Sasha Levin , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 05/30] drm/exynos: fix ref count leak in mic_pre_enable Date: Wed, 8 Jul 2020 11:40:51 -0400 Message-Id: <20200708154116.3199728-5-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200708154116.3199728-1-sashal@kernel.org> References: <20200708154116.3199728-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost [ Upstream commit d4f5a095daf0d25f0b385e1ef26338608433a4c5 ] in mic_pre_enable, pm_runtime_get_sync is called which increments the counter even in case of failure, leading to incorrect ref count. In case of failure, decrement the ref count before returning. Signed-off-by: Navid Emamdoost Signed-off-by: Inki Dae Signed-off-by: Sasha Levin --- drivers/gpu/drm/exynos/exynos_drm_mic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c index f41d75923557a..004110c5ded42 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c @@ -269,8 +269,10 @@ static void mic_pre_enable(struct drm_bridge *bridge) goto unlock; ret = pm_runtime_get_sync(mic->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(mic->dev); goto unlock; + } mic_set_path(mic, 1); -- 2.25.1