You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by yu...@apache.org on 2024/05/10 02:32:46 UTC

(incubator-teaclave-trustzone-sdk) 02/03: Fix double-free bug in optee-utee

This is an automated email from the ASF dual-hosted git repository.

yuanz pushed a commit to branch no-std
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git

commit 124a0f2ada83203e10c507f60bcbe9c37d2fdd54
Author: Ali Zhang <al...@google.com>
AuthorDate: Tue May 7 14:30:50 2024 -0700

    Fix double-free bug in optee-utee
    
    optee-utee needs to forget the session context on invocation error as
    well.
    
    Test: run the `error-handling-rs` example in qemu and observe no panic.
    
    Example run:
    ```
    Welcome to Buildroot, type root or test to login
    buildroot login: root
    0
    ```
---
 optee-utee/macros/src/lib.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/optee-utee/macros/src/lib.rs b/optee-utee/macros/src/lib.rs
index 732ddbc..102df7d 100644
--- a/optee-utee/macros/src/lib.rs
+++ b/optee-utee/macros/src/lib.rs
@@ -396,7 +396,10 @@ pub fn ta_invoke_command(_args: TokenStream, input: TokenStream) -> TokenStream
                             core::mem::forget(b);
                             optee_utee_sys::TEE_SUCCESS
                         },
-                        Err(e) => e.raw_code()
+                        Err(e) => {
+                            core::mem::forget(b);
+                            e.raw_code()
+                        }
                     }
                 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org