aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-26 14:35:55 -0400
committerIan Moffett <ian@osmora.org>2024-04-26 14:35:55 -0400
commit314b80e0e9f8fee490b1d59a0c3db543513eb8be (patch)
treee3ee58a52a2766d84ebc6c7908adb297e550e0ed /sys/kern
parent2d405140e603beb44d8917b0bcf438b915007d12 (diff)
kernel: filedesc: Acquire mutex in write()
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_filedesc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c
index 7e65d77..f7ca2c8 100644
--- a/sys/kern/kern_filedesc.c
+++ b/sys/kern/kern_filedesc.c
@@ -246,6 +246,7 @@ write(int fd, const void *buf, size_t count)
return -EBADF;
}
+ mutex_acquire(&desc->lock);
if (desc->oflag != O_WRONLY && desc->oflag != O_WRONLY) {
ret = -EACCES;
goto cleanup;
@@ -271,6 +272,7 @@ write(int fd, const void *buf, size_t count)
goto cleanup;
}
cleanup:
+ mutex_release(&desc->lock);
dynfree(in_buf);
return ret;
}