Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2026716pxa; Mon, 24 Aug 2020 03:01:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvsVaacQyjm0Lx0oZe5cHlRBM23Qyzz2Qb/LjqiNaLta0rd2bETZuT/e8ZEOuGZsdX6geR X-Received: by 2002:a17:906:3945:: with SMTP id g5mr124123eje.109.1598263270548; Mon, 24 Aug 2020 03:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598263270; cv=none; d=google.com; s=arc-20160816; b=Msr6lXu23sFvnoPFGP2EOdJ6501GnbG3I2PetYGcngRqqqebmb+byexQ2YRaixDJNf qbW627HjuWGbO1nlhHW8K1NKEJFK3SM9OQcRKVYYjqWQoShMSSlx10C5Mf6Dv7tUblq6 kAAyp5OSK2D6pwvYOfzPVAuaLagC/59lEDnYnFwK8ZybTZfUlQAtbbtJIKGnhqo6uNJd OD/bh72rcxsIdDgxSfmaIslUpoH9n16NZeiyxnybrZSCqcy5+3GWNFVMitcVkvLzQFoW 2/6BXEeYmfOShSF+1pnVABWBsJF94lqVV7fot1Ru74EC2kWE3O3EQFNZTDF92m3dr1w5 MUVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IKUKbxXO7XSPru7Go6YT/9/G3vI38p/csv8Z1QPBiFs=; b=q5ulgkMSCNjncsaCOjXH6YKnLXJ2ogssZxTzsCTVvT2FfPkmxulhBYziRzUHOMIdaG FSLBLn/7yWB0yp4yAZV+1ON6eYyYifB55dKFpe4tTQQCDu+Garu9lYaH+3bkF+6Kpqtm wZVYk+HVsXnw3y39k767lzmIQLBo4doRnWhNzN6UzucxP/ajtr9iDjTu/OFF9iEQmRn9 LnLbpmlyI0KO1XcxWSYDekiH3vllZWX+xWffwtUkFDWrLCMJQT9Dp9rw+R4GmTyX1YwK ZdeHuiq7Qi2gKnseOemTX91HT8lcqTvycl1ppvduunX0wqp3dECHqK5WHPOi7J2m6Zz1 IlUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0T8X4rJI; 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 q25si6187897eji.279.2020.08.24.03.00.47; Mon, 24 Aug 2020 03:01:10 -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=0T8X4rJI; 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 S1727905AbgHXJ7I (ORCPT + 99 others); Mon, 24 Aug 2020 05:59:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:41664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbgHXIdt (ORCPT ); Mon, 24 Aug 2020 04:33:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E4803206F0; Mon, 24 Aug 2020 08:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598258028; bh=sXZ8Yu1jQFz3zs2GX8AIx26bfdTxIQt72kwnooGnfdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0T8X4rJIMMj3IoAMiKPqCWMDb1+s8FvCSlTDsCpp4RFgcXG8mBoS8DDTbOp9t6O4D pg8jdAKeW5L6itAhO9Dr57dHO1Gv/hqc5dlQEf853TGzwjamEMgwfTB7fKeVcB2+kD o9OnIrGjen2EFYXjFq2zFASmHBNNfTNMGkSLXN8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.8 047/148] media: budget-core: Improve exception handling in budget_register() Date: Mon, 24 Aug 2020 10:29:05 +0200 Message-Id: <20200824082416.324324720@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824082413.900489417@linuxfoundation.org> References: <20200824082413.900489417@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuhong Yuan [ Upstream commit fc0456458df8b3421dba2a5508cd817fbc20ea71 ] budget_register() has no error handling after its failure. Add the missed undo functions for error handling to fix it. Signed-off-by: Chuhong Yuan Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/ttpci/budget-core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/ttpci/budget-core.c b/drivers/media/pci/ttpci/budget-core.c index fadbdeeb44955..293867b9e7961 100644 --- a/drivers/media/pci/ttpci/budget-core.c +++ b/drivers/media/pci/ttpci/budget-core.c @@ -369,20 +369,25 @@ static int budget_register(struct budget *budget) ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend); if (ret < 0) - return ret; + goto err_release_dmx; budget->mem_frontend.source = DMX_MEMORY_FE; ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->mem_frontend); if (ret < 0) - return ret; + goto err_release_dmx; ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &budget->hw_frontend); if (ret < 0) - return ret; + goto err_release_dmx; dvb_net_init(&budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx); return 0; + +err_release_dmx: + dvb_dmxdev_release(&budget->dmxdev); + dvb_dmx_release(&budget->demux); + return ret; } static void budget_unregister(struct budget *budget) -- 2.25.1