Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp532919pxx; Wed, 28 Oct 2020 10:27:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNFEZaas0UmA4cWCnue61e/ySMjhetFGGfRrFKfoUyID/j6fOKAZkiGwBq5ZlJj1NjSNPH X-Received: by 2002:a17:906:4803:: with SMTP id w3mr136262ejq.406.1603906048413; Wed, 28 Oct 2020 10:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603906048; cv=none; d=google.com; s=arc-20160816; b=wU2zl/mj6Q7Hi0xz3hzfRVDVZI6Ky4i078YP5CTuvhwUYR3k3FP/zLsEwtJIefzUUq UOlsjA4obU46jBZw4uDqwBtW/pqV6Z5lBdI1+9oHLZs5YVoUaT8MqbEbrUbGeR4nnGwI +sPe1zxm7ChJh1MhB4y4hQkAW7qM8z5qxV7P5i56QTJkepc2Cv1vKYJrmSSrZ3E8R/13 YGZSx/Bwx4a+axcsXEXmR2OGjW3d5DZNo53I+/MVQ8KJBeezJNcbaAbYm2tnOnCdQ9cN VybrigGtCfPWRt0hglebSRZRzAY2ZLuR0KcNB+QrUshciLAXpEYhuulPHdhyAnxgqwxj e/wA== 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=1CPf8SlTrpDWwirlFfVML1D44r3XfWragPA2oRHkQJI=; b=0qBlekSYP/03HwGbqm5iHPgWOvU2AJSeAuGGUSpxeji4OrwOtGrWKGW1tDpUKX1BYJ atyGOz58WfJw5WgbQMQ2BQdVf8BaJFlw9aXRBLilpI9AzMdXNyrMMUun32PN38BSqMzM 2ZsJa8dTigBKU4km8TRzO8zYWaLweXhng3QGZkM8HG7RXsWD651rVag8xy+yLMk1jBBk GpxdmJ3++DwdHonKq4bMTlHHrtQZfusdDF8vGDXJX43urHmRQjQf4CW84HEK/T7Wq96o sxWFIKyjo1U9kbDgOnSDDEDEjqKe0cf9nEFZE7h/ucAUOrEP91zY13SuLJfFjDIRFhlw 2dHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LkOKFpHc; 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.10.27.06; Wed, 28 Oct 2020 10:27:28 -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=LkOKFpHc; 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 S1821279AbgJ0RmY (ORCPT + 99 others); Tue, 27 Oct 2020 13:42:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:59520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2902307AbgJ0Ocj (ORCPT ); Tue, 27 Oct 2020 10:32:39 -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 8D8CF207BB; Tue, 27 Oct 2020 14:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809155; bh=mEeQmSRBx3/vkWNYO7IcsFVAEF6jcD2BCQ2Pe4l+80s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LkOKFpHcyoixKgYKnhoP1//XGEJTESzYEUn5eUOEhjZdSARqBRshqCYEk4+M1WDY/ XLK1+2aW1stcfDS6k8dcgtMsMMIeOmq8GGKcyQYeJ4+y3zrf2zaQBwYm0l38dtUMIf I0XScGZ0aMsUDaXLQ6lKglr5m94QybzFiaelBQ9c= 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 096/408] media: stm32-dcmi: Fix a reference count leak Date: Tue, 27 Oct 2020 14:50:34 +0100 Message-Id: <20201027135459.545972342@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 88f50a05f907d96a27a9ce3cc9e8cbb91a6f0f22 ] Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put is not called in error handling paths. Thus replace the jump target "err_release_buffers" by "err_pm_putw". Fixes: 152e0bf60219 ("media: stm32-dcmi: add power saving 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/stm32/stm32-dcmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 9392e3409fba0..d41475f56ab54 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -733,7 +733,7 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) if (ret < 0) { dev_err(dcmi->dev, "%s: Failed to start streaming, cannot get sync (%d)\n", __func__, ret); - goto err_release_buffers; + goto err_pm_put; } ret = media_pipeline_start(&dcmi->vdev->entity, &dcmi->pipeline); @@ -837,8 +837,6 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) err_pm_put: pm_runtime_put(dcmi->dev); - -err_release_buffers: spin_lock_irq(&dcmi->irqlock); /* * Return all buffers to vb2 in QUEUED state. -- 2.25.1