summaryrefslogtreecommitdiff
path: root/Kernel/Net
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-18 00:19:08 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2022-02-18 02:22:12 +0200
commitead8ac8972e77b9df22d07e75c7bbecd74deceb1 (patch)
tree8bf7f7eabadc5887a31c00319245bf0ba7046887 /Kernel/Net
parentb5d891ed6a05edbaf2dd9c5b785c22785c914fba (diff)
downloadserenity-ead8ac8972e77b9df22d07e75c7bbecd74deceb1.zip
Kernel: Lock socket Mutex when servicing IPv4Socket ioctls
This prevents a kernel panic found in CI when m_receive_queue's size is queried and found to be non-zero, then a different thread clears the queue, and finally the first thread continues into the if block and calls the queue's first() method, which then fails an assertion that the queue's size is non-zero.
Diffstat (limited to 'Kernel/Net')
-rw-r--r--Kernel/Net/IPv4Socket.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 9d7342659a..4204ae8f6c 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -609,6 +609,8 @@ ErrorOr<void> IPv4Socket::ioctl(OpenFileDescription&, unsigned request, Userspac
{
TRY(Process::current().require_promise(Pledge::inet));
+ MutexLocker locker(mutex());
+
auto ioctl_route = [request, arg]() -> ErrorOr<void> {
auto user_route = static_ptr_cast<rtentry*>(arg);
rtentry route;