Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp504571pxx; Wed, 28 Oct 2020 09:50:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztsrm5fR/50xmQFQrOy6qT1vWLAexSM8PgIg+L3iviFW4bX0HVye/QGDFQ495bRAQR3orh X-Received: by 2002:aa7:cf99:: with SMTP id z25mr8779036edx.139.1603903801824; Wed, 28 Oct 2020 09:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903801; cv=none; d=google.com; s=arc-20160816; b=To5wZfyGUtTIWGUKzkTmb02QLzBRXioIQ54K5ofI3Vuv5yyJhw4qYSsvSdVrJlsJVB rRBHI+CUDP4kol/IiAmrYFOlBKvYw4tC+a86eqd0WM09PFbr8982URilQiTcXutqYUIH ZghbrZzEnWWwoKiseTy1kTPaHPiCGCbB7rFHDrLN74AX6ikBAfXLZZU4FxXJqVvmv1+r x3zIWxLW5RMgmpijNs1PAFNfGyAu49aW/oSvselFQpsC4m19fyvSgvjG5ZxVnVcu5xhD r4ZBkJ1qXmgwTE9SHtI09hMzRngCyLRHQeoyXKPGg2t5Qpq/5olVb3ha+zqCYmWI7oe5 IFTw== 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=d4x9aywz8ynpIYtQNFkJ4zIfiw3bX6MtfmFP1N3o58k=; b=NtH/89LytbNagoYHy+dvKDuViP5t9n1D1AKLImGZqZGg8O70bihOamxiFd1xERTpRy uSqWV5AbAVHxGpOuce7jtMPZ0G5ZPzcTHMaVkxh2VauVCDhhoSfb/TQlwIOkcU3PmZEQ cbM7ZpzIO8MHhgZb+ml8ul1iSjkjSX7Sba+XgIfrrJ3yJoTz/2VIjvhIn8jIStnE9kSX WEjNU7bKsHJ/5B13eZIqa7CSWwjC7oyd/TpfdPjMwRwAErNx6gWbYNok9DEASXQohDQx dyLIhEY0XTjOUqWSnsQB2rTjDXSNrhKp/JYk9V6UZapKxldAoPfJjzSTeUHyGMV1Xdzq b4AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="h/Dp6ARX"; 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 w11si3696538ejq.533.2020.10.28.09.49.39; Wed, 28 Oct 2020 09:50:01 -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="h/Dp6ARX"; 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 S1818672AbgJ0RWE (ORCPT + 99 others); Tue, 27 Oct 2020 13:22:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:55500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1780750AbgJ0OzA (ORCPT ); Tue, 27 Oct 2020 10:55:00 -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 1FEAE2071A; Tue, 27 Oct 2020 14:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810499; bh=ipHvzcX42wBYYnwHI70OxBqJ5XCYoQQwOnR/I7HYPcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/Dp6ARXd108hMNsOq9UXlONAJfs/gEsBfQ1h/Yrq4gaodI+upDwEyY4Jj0RsI226 CmDnE4LpNlMV8UM4gm6AGu9k2vHOi94pgWhKlgz6+qiaP64iIAZbsmkUmK55nzkGJa PTClBPAS/TNQpWXAkG123zFKxITtD2bYsMemsp2A= 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 143/633] media: stm32-dcmi: Fix a reference count leak Date: Tue, 27 Oct 2020 14:48:06 +0100 Message-Id: <20201027135529.397451578@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 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 b8931490b83b7..fd1c41cba52fc 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