linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/10] media: budget-core: Improve exception handling in budget_register()
@ 2020-08-20  0:03 Sasha Levin
  2020-08-20  0:03 ` [PATCH AUTOSEL 4.4 02/10] media: vpss: clean up resources in init Sasha Levin
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Sasha Levin @ 2020-08-20  0:03 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Chuhong Yuan, Sean Young, Mauro Carvalho Chehab, Sasha Levin,
	linux-media

From: Chuhong Yuan <hslester96@gmail.com>

[ 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 <hslester96@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 e9674b40007c1..6107c469efa07 100644
--- a/drivers/media/pci/ttpci/budget-core.c
+++ b/drivers/media/pci/ttpci/budget-core.c
@@ -386,20 +386,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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-20  0:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20  0:03 [PATCH AUTOSEL 4.4 01/10] media: budget-core: Improve exception handling in budget_register() Sasha Levin
2020-08-20  0:03 ` [PATCH AUTOSEL 4.4 02/10] media: vpss: clean up resources in init Sasha Levin
2020-08-20  0:03 ` [PATCH AUTOSEL 4.4 03/10] Input: psmouse - add a newline when printing 'proto' by sysfs Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 04/10] m68knommu: fix overwriting of bits in ColdFire V3 cache control Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 05/10] xfs: fix inode quota reservation checks Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 06/10] jffs2: fix UAF problem Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 07/10] scsi: libfc: Free skb in fc_disc_gpn_id_resp() for valid cases Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 08/10] virtio_ring: Avoid loop when vq is broken in virtqueue_poll Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 09/10] xfs: Fix UBSAN null-ptr-deref in xfs_sysfs_init Sasha Levin
2020-08-20  0:04 ` [PATCH AUTOSEL 4.4 10/10] alpha: fix annotation of io{read,write}{16,32}be() Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).