diff options
author | Anton Kling <anton@kling.gg> | 2024-02-07 22:22:03 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-02-07 22:25:47 +0100 |
commit | add659ce894352e967905ddf74683f28d2c2e44e (patch) | |
tree | e19a5cfea27f5b177afd2f06960c3bb3c3957959 | |
parent | 08c446612959fb190c7d6f604c69031007c3bc23 (diff) |
Kernel: poll() should skip invalid file descriptors
-rw-r--r-- | kernel/poll.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/poll.c b/kernel/poll.c index ee92a8c..5181417 100644 --- a/kernel/poll.c +++ b/kernel/poll.c @@ -13,6 +13,9 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { if (fds[i].fd < 0) continue; vfs_fd_t *f = get_vfs_fd(fds[i].fd); + if (NULL == f) { + continue; + } if (fds[i].events & POLLIN) read_locks[i] = create_read_fdhalt(f); if (fds[i].events & POLLOUT) |