Skip to contentSkip to conversation

cmd: avb: free partition buffer upon verify completion

PATCH New Gary Bisson 3 participants 3 messages May 11, 2020 – May 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cmd: avb: free partition buffer upon verify completion

Doing the same as the unittests for libavb [1].

Allows to run 'avb verify' multiple times which can be useful after a failure to be able to re-flash the partition and try again.

[1]
https://android.googlesource.com/platform/external/avb/+/refs/tags/android-9.0.0_r37/test/avb_slot_verify_unittest.cc#156

---
Hi,

Changelog v2:
- use avb_slot_verity_data_free as suggested by Igor

This was added because of the following scenario:
1- fastboot flash boot boot.img
2- avb verify
-> fails because vbmeta wasn't updated
3- fastboot flash vbmeta vbmeta.img
4- avb verify
-> fails because it can't allocate memory as previous buffer wasn't
freed

Let me know if you have any questions.

Regards,
Gary

---
 cmd/avb.c | 3 +++
 1 file changed, 3 insertions(+)
cmd/avb.c +3 -0
index a4de5c40a2..93d1a31819 100644
@@ -312,6 +312,9 @@ int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
 		printf("Unknown error occurred\n");
 	}
 
+	if (out_data)
+		avb_slot_verify_data_free(out_data);
+
 	return res;
 }
 
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/1 cmd: avb: free partition buffer upon verify completion

Hi Gary,

Quoted 48 lines · Gary Bisson

Doing the same as the unittests for libavb [1].

Allows to run 'avb verify' multiple times which can be useful after a failure to be able to re-flash the partition and try again.

[1]
https://android.googlesource.com/platform/external/avb/+/refs/tags/android-9.0.0_r37/test/avb_slot_verify_unittest.cc#156

---
Hi,

Changelog v2:
- use avb_slot_verity_data_free as suggested by Igor

This was added because of the following scenario:
1- fastboot flash boot boot.img
2- avb verify
-> fails because vbmeta wasn't updated
3- fastboot flash vbmeta vbmeta.img
4- avb verify
-> fails because it can't allocate memory as previous buffer wasn't
freed

Let me know if you have any questions.

Regards,
Gary

---
 cmd/avb.c | 3 +++
 1 file changed, 3 insertions(+)
cmd/avb.c +3 -1
index a4de5c40a2..93d1a31819 100644
@@ -312,6 +312,9 @@ int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
                printf("Unknown error occurred\n");
        }
 
+       if (out_data)
+               avb_slot_verify_data_free(out_data);
+
        return res;
 }
 
--
Quoted 2 lines

2.26.2

Thanks

Signature · 8 lines
Best regards - Freundliche Gr?sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#2 lore raw

PATCH v2 1/1 cmd: avb: free partition buffer upon verify completion

In reply to Gary Bisson
Quoted 10 lines · Gary Bisson

Doing the same as the unittests for libavb [1].

Allows to run 'avb verify' multiple times which can be useful after a failure to be able to re-flash the partition and try again.

[1]
https://android.googlesource.com/platform/external/avb/+/refs/tags/android-9.0.0_r37/test/avb_slot_verify_unittest.cc#156

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200520/7c2cd102/attachment.sig>