Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1224758pxx; Tue, 27 Oct 2020 11:09:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP8sJ7DtSIq6tc8hOleuBVfh3IQLbpV1mbKdvOCTM/oVKWKdUpGp5tuz6fTJ2H9+IZwwCx X-Received: by 2002:a50:ec02:: with SMTP id g2mr3630424edr.104.1603822160173; Tue, 27 Oct 2020 11:09:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603822160; cv=none; d=google.com; s=arc-20160816; b=kzYKGggi9x/XcjlT2Yc7eC/xJ4tW8veLLkrRjctx0KulwMwt1xsx3q4otOr+GhfE8w vFJSFDIgoXSOsFUqF7j1D7gN4kqQjGcbOoqH3rb3QrR9afKte4LwkzgDPzDZXcpFAdQE mZe9MS99nu65x/kIeYvBogd9aknqXZ1myZeLs//+nyh4YwmkmWMBIxKVDNkV6BkSfZvB bPyrhbL8DKg9c7maRyEjlVRAuJYnQYrnkyu4xEF23MLBWrjoUpSAPALiPhYSFKbhkQS3 sDj178VFUPd73e0fFt8/+5+bBGgUHwiF7jd1bnY8cG+GPCkyILA6rIClLZTI5iQmFuoQ s9sg== 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=Xpj57/eHPdoYUdGRr8vq1VhfLNMldj3JT6SaukGjN+0=; b=OYmRSWpAvBgWVDVn4S6VdYNHni8bAG6c3gg9UjsK0q6EqiP0gL9YbU4sd65LA/DteK ygi3eSkanJ3MwtffTRKjRAHwi2AUYIXqlFZVF47fdAEySACWoHasRy2B8cqHUvarELtF rCsFxvlQTP8xe/vDRVp80KQ7LRIX7QySVN7H66uxy7uYw1qM7kO3hkbUVuPEH1Qy9xMw 9ad6bSslUTZpWEARUMG2+4AGRUaHOYbEVquyVWZxotDSkV9J2NCk5JKCtUk+DctYMcTM x+6AskBxkSzmAf8GX/xtwBdUGhTDDLnuGSyhudtmlfSdBeVdiXe1MUKcN0pwE3fx8OXk QSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wIHkjaFy; 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 m19si1547697ejc.606.2020.10.27.11.08.58; Tue, 27 Oct 2020 11:09:20 -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=wIHkjaFy; 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 S1821306AbgJ0Rmc (ORCPT + 99 others); Tue, 27 Oct 2020 13:42:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:59408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896687AbgJ0Ocb (ORCPT ); Tue, 27 Oct 2020 10:32:31 -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 25A2220725; Tue, 27 Oct 2020 14:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809149; bh=8dWP46Q/wDUBmxbTdzmA+KEgGq9L6z/3idnfwPc+sEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wIHkjaFyeoR6WmkDStXvzj9Lf+x6nLtfWi/OEj5kGBriDK4mLHOpBkIbdAb1PXuXs JzWCo/kKgF5IpZyNmKmsWtK8RMlcwbkMh5tiLwue+ywv/jImz+81v45SJlpp4WtPcO X/L9/dowkmChlomILShNlYOBrN5i34LXPSgb/moQ= 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 094/408] media: camss: Fix a reference count leak. Date: Tue, 27 Oct 2020 14:50:32 +0100 Message-Id: <20201027135459.450525758@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 d0675b67b42eb4f1a840d1513b5b00f78312f833 ] 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 is not called in error handling paths. Thus call pm_runtime_put_sync() if pm_runtime_get_sync() fails. Fixes: 02afa816dbbf ("media: camss: Add basic runtime PM support") Signed-off-by: Qiushi Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/camss/camss-csiphy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index 008afb85023be..3c5b9082ad723 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -176,8 +176,10 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on) int ret; ret = pm_runtime_get_sync(dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_sync(dev); return ret; + } ret = csiphy_set_clock_rates(csiphy); if (ret < 0) { -- 2.25.1