Skip to content

Commit d93f024

Browse files
lyakhkv2019i
authored andcommitted
library-manager: fix a potential NULL dereference
If module registration fails, lib_manager_load_library() will jump to "cleanup" where it will attempt to check whether a module is an LLEXT but in such cases the "mod" pointer can be NULL, which will cause an exception. Check the error code before checking the module type. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 3a2297c commit d93f024

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/library_manager/lib_manager.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ int lib_manager_load_library(uint32_t dma_id, uint32_t lib_id, uint32_t type)
10301030
uint32_t module_id = lib_id << LIB_MANAGER_LIB_ID_SHIFT;
10311031
const struct sof_man_module *mod = lib_manager_get_module_manifest(module_id);
10321032

1033-
if (module_is_llext(mod) && !ret)
1033+
if (!ret && module_is_llext(mod))
10341034
/* Auxiliary LLEXT libraries need to be linked upon loading */
10351035
ret = llext_manager_add_library(module_id);
10361036

@@ -1039,7 +1039,7 @@ int lib_manager_load_library(uint32_t dma_id, uint32_t lib_id, uint32_t type)
10391039
#endif
10401040

10411041
if (!ret)
1042-
tr_info(&ipc_tr, "loaded library id: %u", lib_id);
1042+
tr_info(&lib_manager_tr, "loaded library id: %u", lib_id);
10431043

10441044
return ret;
10451045
}

0 commit comments

Comments
 (0)