blob: 852067bc2f227808d11ea3be968dcac965a00eff [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001Upstream-Status: Pending [Not submitted to upstream yet]
2Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
3
4From 4617f85b70c7e4206b244f3eaffdc62ac3744a17 Mon Sep 17 00:00:00 2001
5From: Jelle Sels <jelle.sels@arm.com>
6Date: Mon, 10 May 2021 11:37:23 +0200
7Subject: [PATCH] Fix: add missing error check during SP init
8
9Error checking during SP initialization (sp_init_uuid()) was lacking.
10As a result an out of CORE HEAP situation resulted in a panic. This was
11due to lack of memory in the inflate() function of zlib.
12
13Signed-off-by: Jelle Sels <jelle.sels@arm.com>
14Change-Id: I287e2e2dd507feb45991b32ed264b3b6ad6fcd39
15
16diff --git a/core/arch/arm/kernel/sp.c b/core/arch/arm/kernel/sp.c
17index 4acbc2e2..23532a01 100644
18--- a/core/arch/arm/kernel/sp.c
19+++ b/core/arch/arm/kernel/sp.c
20@@ -383,10 +383,14 @@ static TEE_Result __attribute__((unused)) sp_init_uuid(const TEE_UUID *uuid)
21 cancel_req_to,
22 &param);
23
24- args.a0 = sp_get_session(sess->id)->sp_regs.x[0];
25- sp_thread(sess->id, FFA_NW_ID, &args);
26+ if (res == TEE_SUCCESS) {
27+ args.a0 = sp_get_session(sess->id)->sp_regs.x[0];
28+ sp_thread(sess->id, FFA_NW_ID, &args);
29
30- thread_spmc_msg_recv(&args, sess->id);
31+ thread_spmc_msg_recv(&args, sess->id);
32+ } else {
33+ EMSG("SP initialization failed, try increasing CFG_CORE_HEAP_SIZE");
34+ }
35
36 return res;
37 }
38--
392.25.1
40