Skip to content

Commit f153935

Browse files
committed
lib_manager: check context allocation on dram restore
The resume path allocated a library context and immediately wrote through it without a NULL check, crashing under memory pressure. Check the allocation and fail the restore gracefully. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 4c16908 commit f153935

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/library_manager/llext_manager_dram.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,14 @@ int llext_manager_restore_from_dram(void)
200200
continue;
201201
}
202202

203-
/* Panics on failure - use the same zone as during the first boot */
204203
struct lib_manager_mod_ctx *ctx = rmalloc(SOF_MEM_FLAG_KERNEL | SOF_MEM_FLAG_COHERENT,
205204
sizeof(*ctx));
206205

206+
if (!ctx) {
207+
tr_err(&lib_manager_tr, "library context allocation failure");
208+
goto nomem;
209+
}
210+
207211
/* Restore the library context */
208212
*ctx = lib_manager_dram.ctx[j++];
209213

0 commit comments

Comments
 (0)