gpoulios commented on code in PR #16356:
URL: https://github.com/apache/nuttx/pull/16356#discussion_r2083480191


##########
drivers/misc/optee.c:
##########
@@ -533,7 +538,16 @@ static int optee_close(FAR struct file *filep)
 
   idr_for_each_entry(priv->shms, shm, id)
     {
-      optee_shm_free(shm);
+      if (shm->fd > -1)
+        {
+          /* The user did not call close(), do it here */
+
+          nx_close(shm->fd);

Review Comment:
   We do in the case that the user explicitly calls `close(driver fd)` before 
`close(shm fd)`. In that case, the shm is left with an invalid `priv` reference 
and it can’t unregister or remove itself.
   
   ...unless there is some parent/child feature for inodes that auto-closes 
children that I’m not aware of.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to