mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cx88-dvb avoid dangling core->gate_ctrl pointer
@ 2011-12-15  5:59 David Fries
  2011-12-18  9:48 ` Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: David Fries @ 2011-12-15  5:59 UTC (permalink / raw)
  To: video4linux-list
  Cc: Mauro Carvalho Chehab, Istvan Varga, Jonathan Nieder,
	linux-media, linux-kernel

From: David Fries <David@Fries.net>

dvb_register calls videobuf_dvb_register_bus, but if that returns
a failure the module will be unloaded without clearing the
value of core->gate_ctrl which will cause an oops in macros
called from video_open in cx88-video.c

Signed-off-by: David Fries <David@Fries.net>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Istvan Varga <istvan_v@mailbox.hu>
Cc: Jonathan Nieder <jrnieder@gmail.com>
---
This is with 3.2.0-rc5+, and it only fixes the oops, it doesn't
resolve why cx88-dvb failed to work.  Any ideas?

cx88/2: cx2388x dvb driver version 0.0.9 loaded
cx88/2: registering cx8802 driver, type: dvb access: shared
cx88[0]/2: subsystem: 7063:3000, board: pcHDTV HD3000 HDTV [card=22]
cx88[0]/2: cx2388x based DVB/ATSC card
cx8802_alloc_frontends() allocating 1 frontend(s)
tuner-simple 1-0061: attaching existing instance
tuner-simple 1-0061: type set to 60 (Thomson DTT 761X (ATSC/NTSC))
DVB: registering new adapter (cx88[0])
DVB: registering adapter 0 frontend 0 (Oren OR51132 VSB/QAM
Frontend)...
cx88[0]: videobuf_dvb_register_frontend failed (errno = -12)
cx88[0]/2: dvb_register failed (err = -12)
cx88[0]/2: cx8802 probe failed, err = -12


 drivers/media/video/cx88/cx88-dvb.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index cf3d33a..3961498 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -954,6 +954,7 @@ static int dvb_register(struct cx8802_dev *dev)
 	struct cx88_core *core = dev->core;
 	struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
 	int mfe_shared = 0; /* bus not shared by default */
+	int res = -EINVAL;
 
 	if (0 != core->i2c_rc) {
 		printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
@@ -1566,13 +1567,16 @@ static int dvb_register(struct cx8802_dev *dev)
 	call_all(core, core, s_power, 0);
 
 	/* register everything */
-	return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
-					 &dev->pci->dev, adapter_nr, mfe_shared, NULL);
+	res = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
+		&dev->pci->dev, adapter_nr, mfe_shared, NULL);
+	if (res)
+		goto frontend_detach;
+	return res;
 
 frontend_detach:
 	core->gate_ctrl = NULL;
 	videobuf_dvb_dealloc_frontends(&dev->frontends);
-	return -EINVAL;
+	return res;
 }
 
 /* ----------------------------------------------------------- */
-- 
1.7.2.5


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

* Re: [PATCH] cx88-dvb avoid dangling core->gate_ctrl pointer
  2011-12-15  5:59 [PATCH] cx88-dvb avoid dangling core->gate_ctrl pointer David Fries
@ 2011-12-18  9:48 ` Jonathan Nieder
  2011-12-19  5:42   ` David Fries
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2011-12-18  9:48 UTC (permalink / raw)
  To: David Fries
  Cc: video4linux-list, Mauro Carvalho Chehab, Istvan Varga,
	linux-media, linux-kernel, Darron Broad, Steven Toth

Hi David,

David Fries wrote:

> DVB: registering new adapter (cx88[0])
> DVB: registering adapter 0 frontend 0 (Oren OR51132 VSB/QAM Frontend)...
> cx88[0]: videobuf_dvb_register_frontend failed (errno = -12)
> cx88[0]/2: dvb_register failed (err = -12)
> cx88[0]/2: cx8802 probe failed, err = -12

Is CONFIG_DVB_NET enabled?  If not, does reverting fcc8e7d8c0e2
(dvb_net: Simplify the code if DVB NET is not defined, 2011-06-01)
help?

Thanks,
Jonathan

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

* Re: [PATCH] cx88-dvb avoid dangling core->gate_ctrl pointer
  2011-12-18  9:48 ` Jonathan Nieder
@ 2011-12-19  5:42   ` David Fries
  0 siblings, 0 replies; 3+ messages in thread
From: David Fries @ 2011-12-19  5:42 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Mauro Carvalho Chehab, Istvan Varga, linux-media, linux-kernel,
	Darron Broad, Steven Toth

On Sun, Dec 18, 2011 at 03:48:59AM -0600, Jonathan Nieder wrote:
> Hi David,
> 
> David Fries wrote:
> 
> > DVB: registering new adapter (cx88[0])
> > DVB: registering adapter 0 frontend 0 (Oren OR51132 VSB/QAM Frontend)...
> > cx88[0]: videobuf_dvb_register_frontend failed (errno = -12)
> > cx88[0]/2: dvb_register failed (err = -12)
> > cx88[0]/2: cx8802 probe failed, err = -12
> 
> Is CONFIG_DVB_NET enabled?  If not, does reverting fcc8e7d8c0e2
> (dvb_net: Simplify the code if DVB NET is not defined, 2011-06-01)
> help?
> 
> Thanks,
> Jonathan

I had CONFIG_DVB_NET disabled, as a desktop system I didn't think
there was any need for it.  I tested with and without reverting
fcc8e7d8c0e2 and with and without CONFIG_DVB_NET enabled.  It always
worked if CONFIG_DVB_NET is enabled, it only works if CONFIG_DVB_NET
is disabled if fcc8e7d8c0e2 is reverted.  Thanks for the tip, you
saved me a whole lot of time trying to track down what was broken.

-- 
David Fries <david@fries.net>    PGP pub CB1EE8F0
http://fries.net/~david/

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

end of thread, other threads:[~2011-12-19  5:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-15  5:59 [PATCH] cx88-dvb avoid dangling core->gate_ctrl pointer David Fries
2011-12-18  9:48 ` Jonathan Nieder
2011-12-19  5:42   ` David Fries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome