mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user