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

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit ab3883a740bf3bb801fab2f523d13b94e521eff9
Author: hujun5 <[email protected]>
AuthorDate: Tue Jul 14 09:33:59 2026 +0800

    tee: fix gen_caps overwrite in optee_ioctl_version
    
    The gen_caps field was first OR-ed with priv->capabilities and then
    unconditionally overwritten by a plain assignment, discarding runtime
    capabilities such as TEE_GEN_CAP_REG_MEM. Set the base caps first and
    OR priv->capabilities afterwards so detected capabilities reach userspace.
    
    Co-authored-by: GitHub Copilot <[email protected]>
    Signed-off-by: hujun5 <[email protected]>
---
 drivers/tee/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tee/optee.c b/drivers/tee/optee.c
index 1321fd31efb..92191eb14a0 100644
--- a/drivers/tee/optee.c
+++ b/drivers/tee/optee.c
@@ -936,11 +936,11 @@ optee_ioctl_close_session(FAR struct optee_priv_data 
*priv,
 static int optee_ioctl_version(FAR struct optee_priv_data *priv,
                                FAR struct tee_ioctl_version_data *vers)
 {
-  vers->gen_caps |= priv->capabilities;
   vers->impl_id = TEE_IMPL_ID_OPTEE;
   vers->impl_caps = TEE_OPTEE_CAP_TZ;
   vers->gen_caps = TEE_GEN_CAP_GP |
                    TEE_GEN_CAP_MEMREF_NULL;
+  vers->gen_caps |= priv->capabilities;
 
   return 0;
 }

Reply via email to