This is an automated email from the ASF dual-hosted git repository.
michallenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new c6536852910 fs/vfs: Release resources on O_NOFOLLOW failure
c6536852910 is described below
commit c653685291012fff1a966e4de8adcc171236b29b
Author: Arnav Sharma <[email protected]>
AuthorDate: Thu Oct 29 17:10:12 2026 +0530
fs/vfs: Release resources on O_NOFOLLOW failure
When O_NOFOLLOW is specified and the resolved inode is a symbolic
link, file_vopen() returns -ELOOP directly. At that point,
inode_find() has acquired an inode reference and
inode_search_setup() has initialized the search descriptor.
Returning directly bypasses the existing cleanup path and can
leave both resources unreleased.
Route the -ELOOP error through errout_with_inode so the inode
reference and search descriptor are released by the established
cleanup sequence.
Fixes #21116
Assisted-by: Claude Opus 5
Assisted-by: GLM 5.3
Signed-off-by: Arnav Sharma <[email protected]>
---
fs/vfs/fs_open.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c
index 9cfae266f7d..7218785955b 100644
--- a/fs/vfs/fs_open.c
+++ b/fs/vfs/fs_open.c
@@ -144,7 +144,8 @@ static int file_vopen(FAR struct file *filep, FAR const
char *path,
if (desc.nofollow && INODE_IS_SOFTLINK(inode))
{
- return -ELOOP;
+ ret = -ELOOP;
+ goto errout_with_inode;
}
#endif