Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9078650pxu; Mon, 28 Dec 2020 06:08:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJx17REXMp1RehTBeeQOlrv2nWiY9RDJdDNHZVvfEcSPuD6aOq6u9QeM9nuoe8zVG+jtnFtN X-Received: by 2002:a50:ac86:: with SMTP id x6mr42308274edc.197.1609164495657; Mon, 28 Dec 2020 06:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164495; cv=none; d=google.com; s=arc-20160816; b=z/MxUTKX28OWUQnKPx33WZ3D6vnI6D1vxJ/hVVDtoA0nNiPfoxd1w2hGrYckmDS9zy Y60riYCHEj4NedCyTL80iFBTB7vDCMNmTjervWUGj7UMsUSF2BWVQ5yR3rzpo24Gz9NT W8/vSnrEskgywbvSQAFsg4TTk4lrMetqFB9oO/+gC7HRqeNDKdnEnuxZBVl+jmKKlURw CY/crzZNrtJPao1EwXVupKRUB8PczT2tBjZ3e/X8XdSzPHazbaM8B2WW/fy77Q8oB1XS mTz9BoVELAD2WFmfGVj1rt5jEclTkgzNXIzRSFxAgw2yKseI/EKYLT/GcKrIBokTmPCF vrPA== 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=8NwinC/M5MIDXhIM9iS1Xw/Cg5mo34fEwOrQToLQOoA=; b=QLMaFBcur2XYbam9UpZGDnaKJ+qqbsGLMTjsiXxDH/DHEHVy3riDapxKSfulwAU/Df 3edIhlizmWwIVL0BrrZvpe/gkRpbfyWRwhjN/aBhOL8jA64hq9lKXBpN/bbb01WT4yrj dKKxnN69q7hkh3LcRXhVgJup5JY+4VPz1yYqTem0NcQB3ktufeLPsKGHTzrBfUyyQTrE paRqZJ1+rZuJ0bJpOYmi+hWOj9W7GqWc9oqEL7+4XhExW49/3FDhymlqDQV3y4zDQzjm Ff3+vAUrKqZso5PAX2wGrF/fA79zXJTioSwaxNOsb16erFgMd0GHtV2hc3GuJ+rvNUKl psRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nBbeNJPQ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qh17si16644797ejb.115.2020.12.28.06.07.52; Mon, 28 Dec 2020 06:08:15 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=nBbeNJPQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437537AbgL1OFB (ORCPT + 99 others); Mon, 28 Dec 2020 09:05:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:38734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437532AbgL1OFA (ORCPT ); Mon, 28 Dec 2020 09:05:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 92AA920731; Mon, 28 Dec 2020 14:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164285; bh=zm8mI4ddHeFzaIzXAhVhOv+rB86brW5E7ItdWEtwglY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBbeNJPQDldUieMFu1yM3c4U9RzhScGRS8p+9SYTeGWpnhRhT1bKo0h8VdsJHOIpb pEptMFjldt6qT1xqH/ILMjtskczInWZJpXC7tK6zJc+FLzPqrOM5LWgg9hsx/ImYZv K8Y5zv7zGRENZ8RLI3/kftSZbpsKhskgd5pxOWJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 127/717] media: cedrus: fix reference leak in cedrus_start_streaming Date: Mon, 28 Dec 2020 13:42:05 +0100 Message-Id: <20201228125027.033419120@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Zhang Qilong [ Upstream commit 940727bf22f74cbdef8de327de34c4ae565c89ea ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in cedrus_start_streaming. We should fix it. Fixes: d5aecd289babf ("media: cedrus: Implement runtime PM") Signed-off-by: Zhang Qilong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/sunxi/cedrus/cedrus_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c index 667b86dde1ee8..911f607d9b092 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c @@ -479,8 +479,10 @@ static int cedrus_start_streaming(struct vb2_queue *vq, unsigned int count) if (V4L2_TYPE_IS_OUTPUT(vq->type)) { ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(dev->dev); goto err_cleanup; + } if (dev->dec_ops[ctx->current_codec]->start) { ret = dev->dec_ops[ctx->current_codec]->start(ctx); -- 2.27.0