]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
common: avb_verify: prevent opening incorrect session
authorIvan Khoronzhuk <ivan.khoronzhuk@gmail.com>
Fri, 27 Jan 2023 20:02:14 +0000 (22:02 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 17 Feb 2023 15:51:28 +0000 (10:51 -0500)
The arg->session is not valid if arg->ret != NULL, so can't be
assigned, correct this.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@globallogic.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
common/avb_verify.c

index 0520a714556448aab966c919316926462cc866bd..48ba8db51e59b1c54dd41fd6dce9bfd7f068da23 100644 (file)
@@ -619,10 +619,11 @@ 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 || arg.ret)
+                       continue;
+
+               ops_data->tee = tee;
+               ops_data->session = arg.session;
        }
 
        return 0;