From e8da0eba6ae078b32bb6dcd68922a555b2926128 Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 5 Oct 2026 14:25:54 -0300 Subject: [PATCH] statvfs: handle vnodes without a vfs --- kernel-src/sys/syscalls/statvfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel-src/sys/syscalls/statvfs.c b/kernel-src/sys/syscalls/statvfs.c index efd25c6a..3f9797fb 100644 --- a/kernel-src/sys/syscalls/statvfs.c +++ b/kernel-src/sys/syscalls/statvfs.c @@ -36,6 +36,11 @@ syscallret_t syscall_fstatvfs(context_t *ctx, int fd, statvfs_t *ustatvfs) { return ret; } + if (file->vnode->vfs == NULL) { + ret.errno = ENODEV; + goto cleanup; + } + fsattr_t buf; ret.errno = VFS_STATFS(file->vnode->vfs, &buf); if (ret.errno) @@ -98,6 +103,11 @@ syscallret_t syscall_fstatvfsat(context_t *ctx, int dirfd, char *upath, stat_t * // locked by vfs_lookup VOP_UNLOCK(node); + if (node->vfs == NULL) { + ret.errno = ENODEV; + goto cleanup; + } + fsattr_t buf; ret.errno = VFS_STATFS(node->vfs, &buf); if (ret.errno)