All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common: avb_verify: prevent opening incorrect session
@ 2023-01-22  2:41 Ivan Khoronzhuk
  2023-01-23  9:55 ` Jens Wiklander
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Ivan Khoronzhuk @ 2023-01-22  2:41 UTC (permalink / raw)
  To: igor.opaniuk, u-boot; +Cc: Jens Wiklander, Ivan Khoronzhuk

The arg->session is not valid if arg->ret != NULL, so can't be
assigned. Leave retry for just "ret" error to save same behaviour.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@gmail.com>
---
 common/avb_verify.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/common/avb_verify.c b/common/avb_verify.c
index 0520a71455..05d5a97896 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -619,10 +619,14 @@ static int get_open_session(struct AvbOpsData *ops_data)
 		memset(&arg, 0, sizeof(arg));
 		tee_optee_ta_uuid_to_octets(arg.uuid, &uuid);
 		rc = tee_open_session(tee, &arg, 0, NULL);
-		if (!rc) {
-			ops_data->tee = tee;
-			ops_data->session = arg.session;
-		}
+		if (rc)
+			continue;
+
+		if (arg.ret)
+			return AVB_IO_RESULT_ERROR_IO;
+
+		ops_data->tee = tee;
+		ops_data->session = arg.session;
 	}
 
 	return 0;
-- 
2.34.1


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

end of thread, other threads:[~2023-02-17 19:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-22  2:41 [PATCH] common: avb_verify: prevent opening incorrect session Ivan Khoronzhuk
2023-01-23  9:55 ` Jens Wiklander
2023-01-23 14:51 ` [PATCH v2] " Ivan Khoronzhuk
2023-01-23 15:34   ` Jens Wiklander
2023-01-23 16:09     ` Ivan Khoronzhuk
2023-01-24 10:15       ` Jens Wiklander
2023-01-27 18:42 ` [PATCH v3] " Ivan Khoronzhuk
2023-01-27 19:45   ` Ivan Khoronzhuk
2023-01-27 20:02 ` [PATCH v4] " Ivan Khoronzhuk
2023-02-02 20:00   ` Ivan Khoronzhuk
2023-02-03 10:59   ` Jens Wiklander
2023-02-17 19:19   ` 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.