From 21b93364d777cbf409139d14eb3e341e2ac1ec33 Mon Sep 17 00:00:00 2001 From: Luo Ji Date: Mon, 12 Feb 2018 16:33:49 +0800 Subject: [PATCH] MA-11363 [Android] Don't free memory for boot image in AVB We read the boot image to a fixed partition which is defined in boot header, this part of memory should not be freed with free() otherwise "Synchronous Abort" error may happen. Change-Id: I0fd9a3e558fda90c4daeee3080e4f9b393e11d98 Signed-off-by: Luo Ji --- lib/avb/libavb/avb_slot_verify.c | 4 +++- lib/avb/libavb_ab/avb_ab_flow.c | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c index 369165e113..0cec5cb7a7 100644 --- a/lib/avb/libavb/avb_slot_verify.c +++ b/lib/avb/libavb/avb_slot_verify.c @@ -1413,7 +1413,9 @@ AvbSlotVerifyResult avb_slot_verify(AvbOps* ops, fail: if (slot_data != NULL) { - avb_slot_verify_data_free(slot_data); + /* the address of bootimage isn't alloced by malloc, + * we should not free it. */ + avb_slot_verify_data_free_fast(slot_data); } return ret; } diff --git a/lib/avb/libavb_ab/avb_ab_flow.c b/lib/avb/libavb_ab/avb_ab_flow.c index 0ef9255fc3..4d48b7366c 100644 --- a/lib/avb/libavb_ab/avb_ab_flow.c +++ b/lib/avb/libavb_ab/avb_ab_flow.c @@ -595,7 +595,9 @@ out: for (n = 0; n < 2; n++) { if (slot_data[n] != NULL) { - avb_slot_verify_data_free(slot_data[n]); + /* the address of bootimage isn't alloced by malloc, + * we should not free it. */ + avb_slot_verify_data_free_fast(slot_data[n]); } } @@ -603,9 +605,7 @@ out: *out_data = data; } else { if (data != NULL) { - /* the address of bootimage isn't alloced by malloc, - * we should not free it. */ - avb_slot_verify_data_free_fast(data); + avb_slot_verify_data_free(data); } } -- 2.17.1