libcamera: ipa_module: verify IPA module API version upon loading
The IPA module API version determines the layout of struct IPAModuleInfo. If this version number does not match, then it means that the IPA module information structure can't be interpreted, and the module can't be used. Validate this version number upon loading the IPA module info from the IPA shared object. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -274,6 +274,11 @@ int IPAModule::loadIPAModuleInfo()
|
||||
ret = elfLoadSymbol<Elf64_Ehdr, Elf64_Shdr, Elf64_Sym>
|
||||
(&info_, sizeof(info_), map, soSize, "ipaModuleInfo");
|
||||
|
||||
if (info_.moduleAPIVersion != IPA_MODULE_API_VERSION) {
|
||||
LOG(IPAModule, Error) << "IPA module API version mismatch";
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
unmap:
|
||||
munmap(map, soSize);
|
||||
close:
|
||||
|
||||
Reference in New Issue
Block a user