This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

davinci_vpfe, module remains in use if channel initialization fails (probable BUG)



Hi,

still not sure if this is the right place to signal bugs (if not please redirect me to the correct section), but I've found this in davinci_vpfe. When the v4l driver is opened, it calls "vpfe_initalize_channel". In turn this calls dec->initialize that is the specific decoder initialization. In most implementations (such as tvp514x) this issues a try_module_get that increments usage count of the module.

Now vpfe_initalize_channel calls "dec->std_ops->getstd", "vpfe_get_std_info", "vpfe_get_std_info". If one of these calls fails, channel->initialized remains 0 and the same happens for fh->initialized.

Then even if the file descriptor is closed, since fh->initialized is 0, dec->deinitialize is never called (even if the decoder has been initialized correctly).

The result is that module_put present in the decoder driver is never called, usage count of the module remains 1 and there is no way to remove the module.

My suggestion is to modify davinci_vpfe to better handle this situation: if something fails, it must call "dec->deinitialize" before exiting.