From 8ba3797e8597e5344f49605dffdec63d0a9b2ddd Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 18 Aug 2022 13:58:14 -0400 Subject: [PATCH] kernel/fs: Check HAS_FS_CALL(..., open_dir) in open_dir_vnode. All filesystems have open_dir calls in their vnode hooks, but there are some vnode hooks that do not, like FIFOs. Thus we need to check the hook actually exists. Fixes #17870. --- src/system/kernel/fs/vfs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index dc840a4749..0540e3edc8 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -5534,6 +5534,9 @@ create_vnode(struct vnode* directory, const char* name, int openMode, static int open_dir_vnode(struct vnode* vnode, bool kernel) { + if (!HAS_FS_CALL(vnode, open_dir)) + return B_UNSUPPORTED; + void* cookie; status_t status = FS_CALL(vnode, open_dir, &cookie); if (status != B_OK)