Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp186798pxx; Wed, 28 Oct 2020 02:05:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwThjUDOvKUHTuAuNA/Bt7yML3/kMwV14aLhVPlphmH8ngF2m/qsskqgaLFc24ICRgR2omj X-Received: by 2002:a50:dac1:: with SMTP id s1mr6705820edj.74.1603875942381; Wed, 28 Oct 2020 02:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875942; cv=none; d=google.com; s=arc-20160816; b=AD/C42oLj+axUs9Pflq2Im5xyldgcY3mcr3Wf47q/wTbpxOuDKe/3G1MxWQBbbgt+A riUvXT38buWoaoYIgex3lSYtXfp+ZpkPbIntVo04gfwmJI7stwiUJhnmY05DqVrGJG6a 8/GyxX1EUd0uHybgVcOXmPAf8phrriI2ivGG0sy/ldyJObPf1vibUV8BI3zC4IfMh7bB zeVj1Rcvv49ywRKXaJ56tqbMiQ66RTZtTj+/EJts+IktqpHWGkMEFTsiet8vxkdyAWsv 9FPxi8IlrERL2EjWCDGcFP+3/VlBAUht+10jB3IfqNI8quSqAjvB//SxwQux4lQx03O9 fiCA== 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=hLv7n6Q+FgBe2ka6YbsK40/UN48w2fgXCrlAA4rhNE4=; b=musJooa1oGXG/AY/Tc4zT04X5kWlu9QUJQxJbXTJJHnTihAf2THVcLEBEFTax+hOj+ NxL3+b+xGNzCcBM0Qyzo8FD2pQRbt6Nwekdw6viuESZH6fVSxMeoYUwFlcCZkvImK3Pl altWCqaAdBTkA+bgPSAGnmPO/o6yJK9PueR+F1TSNrCWtXz2MS4ZbpUOtdxxjTkTy6lY T74QhfspCSrLQAmc3+z2dUJt0F5v/rXKaYBVPY5z4wJg+bbzsGCp3lWv2jjeBAqRETPf 73D+COKh2r0b4RPSsgX9kLBk/NyFowd2Q0vcP/DxMpVMf8dRu/KmeR0m6eNnmgZQbZ6t cGCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZhpSC0+J; 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 w17si2969573ejk.629.2020.10.28.02.05.19; Wed, 28 Oct 2020 02:05:42 -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=ZhpSC0+J; 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 S1757040AbgJ0OPz (ORCPT + 99 others); Tue, 27 Oct 2020 10:15:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:60090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2506305AbgJ0OLI (ORCPT ); Tue, 27 Oct 2020 10:11:08 -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 20EC0218AC; Tue, 27 Oct 2020 14:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807867; bh=JChFd0gn/hhL+kqbOL4AvOcrrDnDlUyDzEVHjw3Bthw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZhpSC0+JZOWLmxqP/5noi7DeXeYwzkFl+27EU8zuMD2Q86H6q6iOJSN0R7nwJj1vZ Fleu0CGj8/kRPGiLXtfYXtx/cNSujenYxO/5GLxWPorFMgHpn8Upi+Mlrfe4zq1lr5 BOYR+kBvWU3QoLcK+i+lpShytVGuS5dG9iAeyByY= 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 4.14 039/191] media: ti-vpe: Fix a missing check and reference count leak Date: Tue, 27 Oct 2020 14:48:14 +0100 Message-Id: <20201027134911.617138227@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 2e8970c7e22da..bbd8bb611915c 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -2470,6 +2470,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