Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp534809pxb; Wed, 3 Mar 2021 09:03:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsBkwtP+hXUYEG4JihZib8Nj2S0XBE449xULAuzwWa0uEkfXNwavxauQ1VAMajirxDOYjA X-Received: by 2002:a05:6402:1c08:: with SMTP id ck8mr256902edb.154.1614791033808; Wed, 03 Mar 2021 09:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614791033; cv=none; d=google.com; s=arc-20160816; b=GYRCYvJh+rGv7XhQegvTLkmzDZ8ro891Yw4pINzpwHT2a0HZfGqbpA+InRgpPcvJ+I U4U5kxR34TyR7VBfpXGNFA+/x9AYx+xgpJWb7diQ1Xpxkmx3hPUZAkWoZagL37s5QHUW RLq4VTbF8Ik4PemoZSyHZ7h++9yZvnck1vTRDVO/MKMub6J/JShsWWbQ+cpjgxTA5g7M c/jJvel/0zOliMvpxgdvtyx2oCnWpEqGm5yYKmPSOtReacm5D6oh8ViiYNSjQW/UQnks qmlOJYLBaaly0+BGm9KjRX4ZtKvszL5aLa3gy6Rem+CfA9ET/zGq+4jMJIcx6EJfgogy R9kw== 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=7Q/D5tjkmFvW+EEZHXYQvSRdxW07v8/2QHWGDf0yoPw=; b=M0QhJjvbNa5LqWjruBRDDbm1Mxk2QrgLV6cSkCPr6PMriPZQZvdpAZJdiqMzFiEESy CxgpGsQLQjoWWstQWEdl1sBGY/lbHK85QeCaW1yIW0lkDh1TWfWLldQR19MKLaX2IZZ9 u5tgFEentknVM+JD+/Lvi3gLyFdmWiLp5NYkI+DtnR1GkMiAEi/f2X9fZewy3kB4m/xk tTa7YsEnb8CdNDC0bXVFWB7m+1qwH+CVT22asZ1WQ2N8PH0iOXuMG6xWtRKYwIvsNQcN C7Hyx3NexVg0lQSY3vsacQO7Q6o71iVoJMkoNNQZZlF9LK/5BJBPLP62IfoLLeplbqBb tDng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uIOluibh; 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 c12si16942855eja.386.2021.03.03.09.03.21; Wed, 03 Mar 2021 09:03:53 -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=uIOluibh; 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 S1376573AbhCBA3b (ORCPT + 99 others); Mon, 1 Mar 2021 19:29:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:47678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239947AbhCASbt (ORCPT ); Mon, 1 Mar 2021 13:31:49 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB265651A5; Mon, 1 Mar 2021 17:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618734; bh=szcTyCxuwgUNa++4Ndccoj2lfKzm/iCe/BfGwV47W4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIOluibhXZQBq1v1qrnybQfuw8imR0YZ19qma4arBEWq1GgaZlwsGuBMjwk+ZECxY e8xFVBx51F94rivSZfi4HZohN5+I1fKpguirV8u5iQG6kUP1+1aTdmxPKVDNPO3ejO VqJbpQRACM3LAdYrddtDNqZZcjYXKbH/iM6HTzwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 167/663] media: media/pci: Fix memleak in empress_init Date: Mon, 1 Mar 2021 17:06:55 +0100 Message-Id: <20210301161150.043888185@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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: Dinghao Liu [ Upstream commit 15d0c52241ecb1c9d802506bff6f5c3f7872c0df ] When vb2_queue_init() fails, dev->empress_dev should be released just like other error handling paths. Fixes: 2ada815fc48bb ("[media] saa7134: convert to vb2") Signed-off-by: Dinghao Liu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/saa7134/saa7134-empress.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 39e3c7f8c5b46..76a37fbd84587 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -282,8 +282,11 @@ static int empress_init(struct saa7134_dev *dev) q->lock = &dev->lock; q->dev = &dev->pci->dev; err = vb2_queue_init(q); - if (err) + if (err) { + video_device_release(dev->empress_dev); + dev->empress_dev = NULL; return err; + } dev->empress_dev->queue = q; dev->empress_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; -- 2.27.0