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

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

commit 3fe1d1a54db97e49880dbee6b2dd84ba1654926e
Author: Ville Juven <ville.ju...@unikie.com>
AuthorDate: Mon May 12 18:03:38 2025 +0300

    fs/pseudofs: Add missing bumping of inode refcount
    
    When a new pseudofile is created, the inode reference count needs to
    be bumped to protect the node.
    
    Signed-off-by: Ville Juven <ville.ju...@unikie.com>
---
 fs/vfs/fs_pseudofile.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/vfs/fs_pseudofile.c b/fs/vfs/fs_pseudofile.c
index df896a5078..a6fadb02c2 100644
--- a/fs/vfs/fs_pseudofile.c
+++ b/fs/vfs/fs_pseudofile.c
@@ -493,6 +493,7 @@ int pseudofile_create(FAR struct inode **node, FAR const 
char *path,
   (*node)->i_flags = 1;
   (*node)->u.i_ops = &g_pseudofile_ops;
   (*node)->i_private = pf;
+  atomic_fetch_add(&(*node)->i_crefs, 1);
 
   inode_unlock();
 #ifdef CONFIG_FS_NOTIFY

Reply via email to