All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cmd: avb: free partition buffer upon verify completion
@ 2020-05-11 10:11 Gary Bisson
  2020-05-12 13:12 ` Igor Opaniuk
  2020-05-20 12:23 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Gary Bisson @ 2020-05-11 10:11 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
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(+)

diff --git a/cmd/avb.c b/cmd/avb.c
index a4de5c40a2..93d1a31819 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -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;
 }
 
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] cmd: avb: free partition buffer upon verify completion
  2020-05-11 10:11 [PATCH v2] cmd: avb: free partition buffer upon verify completion Gary Bisson
@ 2020-05-12 13:12 ` Igor Opaniuk
  2020-05-20 12:23 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Opaniuk @ 2020-05-12 13:12 UTC (permalink / raw)
  To: u-boot

Hi Gary,

On Mon, May 11, 2020 at 1:11 PM Gary Bisson
<gary.bisson@boundarydevices.com> wrote:
>
> 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
>
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
> 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(+)
>
> diff --git a/cmd/avb.c b/cmd/avb.c
> index a4de5c40a2..93d1a31819 100644
> --- a/cmd/avb.c
> +++ b/cmd/avb.c
> @@ -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;
>  }
>
> --
> 2.26.2
>

Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>

Thanks

-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] cmd: avb: free partition buffer upon verify completion
  2020-05-11 10:11 [PATCH v2] cmd: avb: free partition buffer upon verify completion Gary Bisson
  2020-05-12 13:12 ` Igor Opaniuk
@ 2020-05-20 12:23 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-05-20 12:23 UTC (permalink / raw)
  To: u-boot

On Mon, May 11, 2020 at 12:11:53PM +0200, Gary Bisson wrote:

> 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
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-20 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 10:11 [PATCH v2] cmd: avb: free partition buffer upon verify completion Gary Bisson
2020-05-12 13:12 ` Igor Opaniuk
2020-05-20 12:23 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.