aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Fries <david@fries.net>2011-12-14 23:59:20 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-30 14:38:15 -0500
commit7b0962d32362a0d56627a1dfdb4e8229c5f51f94 (patch)
tree9cf041ff5778e3479808f50487a730ca60ea518d
parentb16ec6f735b8f8588c7c3e7703f7ad6267715eb8 (diff)
[media] cx88-dvb avoid dangling core->gate_ctrl pointer
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> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c10
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 cf3d33ab541b..396149824fcd 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)
954 struct cx88_core *core = dev->core; 954 struct cx88_core *core = dev->core;
955 struct videobuf_dvb_frontend *fe0, *fe1 = NULL; 955 struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
956 int mfe_shared = 0; /* bus not shared by default */ 956 int mfe_shared = 0; /* bus not shared by default */
957 int res = -EINVAL;
957 958
958 if (0 != core->i2c_rc) { 959 if (0 != core->i2c_rc) {
959 printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name); 960 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)
1566 call_all(core, core, s_power, 0); 1567 call_all(core, core, s_power, 0);
1567 1568
1568 /* register everything */ 1569 /* register everything */
1569 return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, 1570 res = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
1570 &dev->pci->dev, adapter_nr, mfe_shared, NULL); 1571 &dev->pci->dev, adapter_nr, mfe_shared, NULL);
1572 if (res)
1573 goto frontend_detach;
1574 return res;
1571 1575
1572frontend_detach: 1576frontend_detach:
1573 core->gate_ctrl = NULL; 1577 core->gate_ctrl = NULL;
1574 videobuf_dvb_dealloc_frontends(&dev->frontends); 1578 videobuf_dvb_dealloc_frontends(&dev->frontends);
1575 return -EINVAL; 1579 return res;
1576} 1580}
1577 1581
1578/* ----------------------------------------------------------- */ 1582/* ----------------------------------------------------------- */