syscalls: fix vnode cleanup in some *at syscalls

Some *at functions have a cleanup goto which could use an uninitialized
vnode. Fix this by defining the vnodes earlier.

Found by syzkaller fuzzing.
This commit is contained in:
Matheus
2026-10-09 01:41:48 -03:00
parent c6c74396d6
commit b52882f3f7
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -26,6 +26,7 @@ syscallret_t syscall_readlinkat(context_t *, int dirfd, char *upath, char *ubuff
return ret;
}
vnode_t *node = NULL;
file_t *file = NULL;
vnode_t *dirnode = NULL;
char *buffer = NULL;
@@ -33,7 +34,6 @@ syscallret_t syscall_readlinkat(context_t *, int dirfd, char *upath, char *ubuff
if (ret.errno)
goto cleanup;
vnode_t *node = NULL;
ret.errno = vfs_lookup(&node, dirnode, path, NULL, VFS_LOOKUP_NOLINK);
if (ret.errno)
goto cleanup;
+1 -1
View File
@@ -90,13 +90,13 @@ syscallret_t syscall_fstatvfsat(context_t *ctx, int dirfd, char *upath, stat_t *
return ret;
}
vnode_t *node = NULL;
vnode_t *dirnode = NULL;
file_t *file = NULL;
ret.errno = dirfd_enter(path, dirfd, &file, &dirnode);
if (ret.errno)
goto cleanup;
vnode_t *node = NULL;
ret.errno = vfs_lookup(&node, dirnode, path, NULL, flags & AT_SYMLINK_NOFOLLOW ? VFS_LOOKUP_NOLINK : 0);
if (ret.errno)
goto cleanup;