From 9b4eb44581f4cecf87fb8f2d753e00553d6d6c29 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Tue, 4 Jun 2019 16:32:12 -0400 Subject: 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 Reviewed-by: Laurent Pinchart --- src/libcamera/ipa_module.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libcamera/ipa_module.cpp') 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 (&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: -- cgit v1.2.1