Commit 33c68533 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] dvb-usb-v2: postpone removal of media_device

We should not remove the media_device until its last usage,
or we may have use after free troubles.

So, move the per-adapter media_device removal to happen at
the end of the adapter removal code.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 0230d60e
...@@ -542,7 +542,6 @@ static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) ...@@ -542,7 +542,6 @@ static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
adap->demux.dmx.close(&adap->demux.dmx); adap->demux.dmx.close(&adap->demux.dmx);
dvb_dmxdev_release(&adap->dmxdev); dvb_dmxdev_release(&adap->dmxdev);
dvb_dmx_release(&adap->demux); dvb_dmx_release(&adap->demux);
dvb_usbv2_media_device_unregister(adap);
dvb_unregister_adapter(&adap->dvb_adap); dvb_unregister_adapter(&adap->dvb_adap);
} }
...@@ -852,6 +851,7 @@ static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d) ...@@ -852,6 +851,7 @@ static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
dvb_usbv2_adapter_dvb_exit(&d->adapter[i]); dvb_usbv2_adapter_dvb_exit(&d->adapter[i]);
dvb_usbv2_adapter_stream_exit(&d->adapter[i]); dvb_usbv2_adapter_stream_exit(&d->adapter[i]);
dvb_usbv2_adapter_frontend_exit(&d->adapter[i]); dvb_usbv2_adapter_frontend_exit(&d->adapter[i]);
dvb_usbv2_media_device_unregister(&d->adapter[i]);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment