[linux-dvb] USB driver dmxdev crash on disconnection

Mark Watson linuxtv at foft.fsnet.co.uk
Sun Mar 19 20:42:22 CET 2006


First a bit of background. About a year and a half ago I built myself a PVR 
using a Cypress FX2 to feed an mpeg TS from a digibox. This has been working 
great except the FX2 disconnects every few weeks (possibly heat related, I've 
just fitted a heatsink...). I'm finally trying to get to the bottom of why it 
crashes when it disconnects, with the help of kgdb. I can generally reproduce 
this crash by unplugging with vdr is running.

My driver source is available at:
http://www.scrameta.net/skympeg/dvb_skympeg.c (Feeds a whole transponder from 
an already configured FX2, filters a bit and pumps it into the kernel dvb 
demux)
http://www.scrameta.net/skympeg/dvb_skympeg_fe.c (Just a stub for fake tuning 
to allow vdr to work)

In dvb_skympeg.c my cleanup code, called on usb disconnect, does something 
like:
        dev->dvb_demux.dmx.close(&dev->dvb_demux.dmx);
        dev->dvb_demux.dmx.remove_frontend(&dev->dvb_demux.dmx, &dev->fe_hw);
        dev->dvb_demux.dmx.remove_frontend(&dev->dvb_demux.dmx, &dev->fe_mem);
        err("dvb_demux...");

        dvb_dmxdev_release(&dev->dmxdev);
        dvb_dmx_release(&dev->dvb_demux);
        err("dvb_dmx_release");

        if (dev->dvb_frontend) dvb_unregister_frontend(dev->dvb_frontend);
        dev->dvb_frontend = 0;
        err("dvb_unregister_frontend");

        dvb_unregister_adapter(&dev->adapter);
        err("dvb_unregister_adapter");

The problem occurs after it has logged "dvb_dmx_release". The crash is in 
dmxdev.c:983 (in 2.6.15.6 official) in dvb_demux_poll, as called by vdr. Now 
I can see why dmxdevfilter is invalid, since its been freed, but I'm not sure 
how to avoid this since I already called dvb_dmxdev_release. Do I need to 
check no-one is using the device before calling dvb_dmxdev_release? I do have 
an open count on my device (though I think thats for USB?), but no-one has it 
open. Sorry, not got much experience with device drivers on linux...

Hope someone can help.

Thanks,

Mark



More information about the linux-dvb mailing list