From 3773999f93763f6d04bcdff0da4e75450701996a Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 25 Jan 2023 19:10:35 -0500 Subject: [PATCH] kernel/fs: Add permissions check to rootfs_open. Missed in the earlier commit which added permissions checks to the other functions. --- src/system/kernel/fs/rootfs.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/fs/rootfs.cpp b/src/system/kernel/fs/rootfs.cpp index 569b898792..6180b51bfd 100644 --- a/src/system/kernel/fs/rootfs.cpp +++ b/src/system/kernel/fs/rootfs.cpp @@ -603,7 +603,11 @@ rootfs_open(fs_volume* _volume, fs_vnode* _v, int openMode, void** _cookie) if ((openMode & O_DIRECTORY) != 0 && !S_ISDIR(vnode->stream.type)) return B_NOT_A_DIRECTORY; - // allow to open the file, but it can't be done anything with it + status_t status = rootfs_check_permissions(vnode, W_OK); + if (status != B_OK) + return status; + + // allow to open the file, but nothing can be done with it *_cookie = NULL; return B_OK;