summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2019-06-04 16:32:12 -0400
committerPaul Elder <paul.elder@ideasonboard.com>2019-06-05 10:44:51 -0400
commit9b4eb44581f4cecf87fb8f2d753e00553d6d6c29 (patch)
treeed61edafa10675874fb88b6ce782ddb72dc7c53a /src
parent677e8e1dfedbc363cfab0403fd69ce8ecf61841f (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/ipa_module.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
index f79a44e7..ac166402 100644
--- a/src/libcamera/ipa_module.cpp
+++ b/src/libcamera/ipa_module.cpp
@@ -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: