summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-08 12:33:36 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-08 12:47:37 +0100
commit50056d1d84f654043b8f4401135ec3ec08a3478c (patch)
tree84c13402b68b0e1b0117ba77fe17af7e4fa1b7ea /Kernel
parent3f35cd2f7d9ca60188b3b057cdb2ba23f050d745 (diff)
downloadserenity-50056d1d84f654043b8f4401135ec3ec08a3478c.zip
Kernel: mmap() should fail with ENODEV for directories
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 6dab0e51b6..4fef1e77ff 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -339,6 +339,8 @@ void* Process::sys$mmap(const Syscall::SC_mmap_params* user_params)
auto description = file_description(fd);
if (!description)
return (void*)-EBADF;
+ if (description->is_directory())
+ return (void*)-ENODEV;
if ((prot & PROT_READ) && !description->is_readable())
return (void*)-EACCES;
if ((prot & PROT_WRITE) && !description->is_writable())