Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp500034pxx; Wed, 28 Oct 2020 09:43:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLTtnE7H4+fbbkAVijhP1il8Fq3s3uqpllT+yFlLNPj3GeQhrE/H3QQicjVOJBXkHoyzsl X-Received: by 2002:a17:906:274b:: with SMTP id a11mr8512593ejd.129.1603903407734; Wed, 28 Oct 2020 09:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903407; cv=none; d=google.com; s=arc-20160816; b=KUGBAO5WkuuJdW9ZZe28Pnf1FDaP+/s07QALGPzDls9VrCPUCyt0dLhHC2i/Ek1JM/ Za69CjQ9MUg5JIh4KNJboKyNTzgyM1ThRjclHqCHy4CHIVcJ6FSjSWUl7cL0px0pZ7Cq WhIY98oqkIxCjeanli/pjqm4oceaFaf4EOuM0mnH/FdH0EbmTC86VBuMGA/3vBTJb/ZC lvxhVUllDveR7Pjw/o/8YbjrL3fL1ADSFzLOZIGBbIrBZoiI65IUkF0Ygz2nuRtMUqX6 Laj8IXKoxSBAgeIfYDWAP00UQZh4TvNH+ehU6/o3bcbJ7ffL6mEDSZ1Z754mNEiQmBas ZXwg== 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=+JooQFtdarpFIwaoGHOY+GwK/0nB5hqiEUMVWZa67PQ=; b=0uNvZ/SVFJ8sDQccMUYkCzs6BOtJYnkxWtjCkSe2pa5InbxbEmJ/8cyoQcuWEP0Vmz F8M5ahQn94GZyhO+QU3gfJdJS5v9QJEnvDfaJacNixZIdQwEs4fmPCtCEH2CrWB+/p7D zy7oNrRTytg/6FuGGq7qv+chN+f9DoMLA1Oso7x4zgUmVG5F/lbZZZG07YzUh7Fhgq1V 1v61V6T6vl6gVDEenSqcIGYxxehuyU2SEdtn74g6t+mND5eQa1BIsnn/Th/yBH4Qd5uW U48zHRheJDWVlHyqwUgmYRxqH2wCKY11gt7gGAjVP115oFpbOOp41uObyMCcnWKVKlZ0 Hkig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="kbApbmW/"; 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 n18si9672edr.422.2020.10.28.09.43.05; Wed, 28 Oct 2020 09:43:27 -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="kbApbmW/"; 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 S1818285AbgJ0RSt (ORCPT + 99 others); Tue, 27 Oct 2020 13:18:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:56104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1772437AbgJ0Ozb (ORCPT ); Tue, 27 Oct 2020 10:55: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 3564B20679; Tue, 27 Oct 2020 14:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810530; bh=KOXJTid2xDyZt25H6x3ZKA2YehySt6F2hi3jIR4IdJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbApbmW/eQDCnXuAiENOr1gAa0eTEpY0IuXmselrK5oQsTsYvBg/4a//nD1PHh9ir at8HhSsq/ZbaQWwSJrwHtk0IyIaT0kyzyzlGwOWd2IwBWuN04JnLvBRRBfEUuVL48C VkKKuUCWJsUmnUqVSQ7sBjIOOSw6tQN10vrvMuHg= 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 144/633] media: ti-vpe: Fix a missing check and reference count leak Date: Tue, 27 Oct 2020 14:48:07 +0100 Message-Id: <20201027135529.446461995@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 7dae2aaaf432767ca7aa11fa84643a7c2600dbdd ] 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. And also, when the call of function vpe_runtime_get() failed, we won't call vpe_runtime_put(). Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails inside vpe_runtime_get(). Fixes: 4571912743ac ("[media] v4l: ti-vpe: Add VPE mem to mem driver") Signed-off-by: Qiushi Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/ti-vpe/vpe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index cff2fcd6d812a..82d3ee45e2e90 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -2475,6 +2475,8 @@ static int vpe_runtime_get(struct platform_device *pdev) r = pm_runtime_get_sync(&pdev->dev); WARN_ON(r < 0); + if (r) + pm_runtime_put_noidle(&pdev->dev); return r < 0 ? r : 0; } -- 2.25.1