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 d3e5e756c577625b7ad2f5bd746843824375afd7 Author: buxiasen <[email protected]> AuthorDate: Wed Jul 16 12:14:33 2025 +0800 fs/vfs/symlink: fix the inode information update outside of lock For re-enter case, the inode information may unlock with not filled, and get by other user. that lead to the error behavior. Especially SMP scene. Signed-off-by: buxiasen <[email protected]> --- fs/vfs/fs_symlink.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/vfs/fs_symlink.c b/fs/vfs/fs_symlink.c index c06d231a890..552b1397774 100644 --- a/fs/vfs/fs_symlink.c +++ b/fs/vfs/fs_symlink.c @@ -146,6 +146,15 @@ int symlink(FAR const char *path1, FAR const char *path2) inode_lock(); ret = inode_reserve(path2, 0777, &inode); + + if (ret >= 0) + { + /* Initialize the inode */ + + INODE_SET_SOFTLINK(inode); + inode->u.i_link = newpath2; + } + inode_unlock(); if (ret < 0) { @@ -153,11 +162,6 @@ int symlink(FAR const char *path1, FAR const char *path2) errcode = -ret; goto errout_with_search; } - - /* Initialize the inode */ - - INODE_SET_SOFTLINK(inode); - inode->u.i_link = newpath2; } /* Symbolic link successfully created */
