From f99af1bef0068bc4309f741ace7f8028282da964 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 21 Nov 2021 20:03:11 +0100 Subject: Kernel: Make sure OpenFileDescription is kept alive while read() blocks It's not safe to store OpenFileDescription in a raw pointer when blocking, since another thread may decide to close the corresponding file descriptor. --- Kernel/Syscalls/read.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index 2de85e5bbf..190a7fe8c5 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -12,7 +12,7 @@ namespace Kernel { using BlockFlags = Thread::FileBlocker::BlockFlags; -static ErrorOr open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd) +static ErrorOr> open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd) { auto description = TRY(fds.open_file_description(fd)); if (!description->is_readable()) -- cgit v1.2.3