Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp532345pxx; Wed, 28 Oct 2020 10:26:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqHpTRs5h1cSXqv13NgPJYGXc2kLPKFSQH1cx7sqLJN6JdkW0x72/SQQJfT1hs0/BKk7/T X-Received: by 2002:aa7:cb1a:: with SMTP id s26mr8932182edt.219.1603905995003; Wed, 28 Oct 2020 10:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603905994; cv=none; d=google.com; s=arc-20160816; b=W9mB6kaSP0sf7CUmn5fp/974u+/vdFLAKr1vogdr36QV0scVNv+B6yS0HYqSslco9V xkbOupPRGcWo5igZZxT0rjkqTz6FiS8gfVmcHdzryzMnkivkhnQ/oc+gIvOoYc19icQy yWCFkHDIpqIVCX56KHhv/dzQuoC/jrSYfuBgJRcgIW7ouV/yVrgza5ryRoyGxNpjUDw8 78TO6YBKMEHVt7yG+HcIx3OQZsD2wrJSTOb/Si3cl5HMAgf9eFuqj02JgDjRF8+Op/yb Cy4vD62nfvT9sA0DrVR3aQwhc+agI2tpG2xrV1yDMD2/gq30d7+Y1OdurPLb738ojead Om+Q== 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=ovUaVRSsixFYMbaIsis+Xr10W595+ztaW1UJv7mdMm0=; b=03lMn9ZKehp7jxgOWOue91SXFBZTM++7lDq0x32pp+LrFXh7NLQobPuwmFCIAKqvVb h27qgMjtngMsioIKpqm3mkcWBrtaKYhOF1brvzekE1Mw45nsOrVCTfVYtBwfYc5SloIO 0acVexslBKRoOwhq/nuqs8VItQNBeEzzt/uE8Hbq5K5P8/UMy4+p1K1DdFHvHVFWBde5 dgBAZChAjhQL5j85pxrOC3dtY9AzCmUC7Kks3nyP/Kt47lBDuXfAZPVHRl/Pa65mgWI6 dY/3Dma3ryIVxb7gSn52eTGvpBWyKkSRvIcfEdQU1TQ90CHEmtsLFVa95L0nu6+yuDJk 2KRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sopvvfvj; 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 w23si165eds.571.2020.10.28.10.26.12; Wed, 28 Oct 2020 10:26:34 -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=sopvvfvj; 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 S1821226AbgJ0Rl1 (ORCPT + 99 others); Tue, 27 Oct 2020 13:41:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:59518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2902311AbgJ0Ock (ORCPT ); Tue, 27 Oct 2020 10:32:40 -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 C5B9D20773; Tue, 27 Oct 2020 14:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809152; bh=P4a75jnVXDWT0V3ovpmOnRfZTRnN5zdieUF7mNfbbWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sopvvfvjOuRHGOhFtQha4SZZieybEbyE7B2D+BtezPkhX2PRiBADVF1QS0JqzD2Vn LJfdqWg/bmX/Xqq0/lgXCSPP5mCnIWwkKA5CPy0m7dv36j7xgjUJYF04jTU5xLgYPh m9PUBeLl7IaEVXr781ejbLsmfPLyZc/1aDA2TUBY= 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 095/408] media: s5p-mfc: Fix a reference count leak Date: Tue, 27 Oct 2020 14:50:33 +0100 Message-Id: <20201027135459.501425037@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 78741ce98c2e36188e2343434406b0e0bc50b0e7 ] pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails. Fixes: c5086f130a77 ("[media] s5p-mfc: Use clock gating only on MFC v5 hardware") Signed-off-by: Qiushi Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 7d52431c2c837..62d2320a72186 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c @@ -79,8 +79,10 @@ int s5p_mfc_power_on(void) int i, ret = 0; ret = pm_runtime_get_sync(pm->device); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(pm->device); return ret; + } /* clock control */ for (i = 0; i < pm->num_clocks; i++) { -- 2.25.1