Message ID | 20190605005316.4835-5-paul.elder@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thank you for the patch. On Tue, Jun 04, 2019 at 08:53:10PM -0400, Paul Elder wrote: > 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 cannot be loaded at all. I would say "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> > --- > New patch > > src/libcamera/ipa_module.cpp | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp > index f79a44e..2aa508c 100644 > --- a/src/libcamera/ipa_module.cpp > +++ b/src/libcamera/ipa_module.cpp > @@ -274,6 +274,9 @@ int IPAModule::loadIPAModuleInfo() > ret = elfLoadSymbol<Elf64_Ehdr, Elf64_Shdr, Elf64_Sym> > (&info_, sizeof(info_), map, soSize, "ipaModuleInfo"); > > + if (info_.moduleAPIVersion != IPA_MODULE_API_VERSION) > + ret = -EINVAL; Please log a debug message, and Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + > unmap: > munmap(map, soSize); > close:
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index f79a44e..2aa508c 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -274,6 +274,9 @@ int IPAModule::loadIPAModuleInfo() ret = elfLoadSymbol<Elf64_Ehdr, Elf64_Shdr, Elf64_Sym> (&info_, sizeof(info_), map, soSize, "ipaModuleInfo"); + if (info_.moduleAPIVersion != IPA_MODULE_API_VERSION) + ret = -EINVAL; + unmap: munmap(map, soSize); close:
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 cannot be loaded at all. Validate this version number upon loading the IPA module info from the IPA shared object. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- New patch src/libcamera/ipa_module.cpp | 3 +++ 1 file changed, 3 insertions(+)