Kernel: Fix spinlock bugs found by the new spinlock security

This commit is contained in:
Bananymous 2025-05-30 22:02:17 +03:00
parent 6542a037df
commit 692ba43182
2 changed files with 14 additions and 11 deletions

View File

@ -281,10 +281,11 @@ namespace Kernel
if (!is_streaming())
m_packet_sizes.push(packet.size());
epoll_notify(EPOLLIN);
m_packet_thread_blocker.unblock();
m_packet_lock.unlock(state);
epoll_notify(EPOLLIN);
return {};
}

View File

@ -87,6 +87,7 @@ namespace Kernel
}
bool PseudoTerminalMaster::putchar(uint8_t ch)
{
{
SpinLockGuard _(m_buffer_lock);
@ -96,9 +97,10 @@ namespace Kernel
reinterpret_cast<uint8_t*>(m_buffer->vaddr())[(m_buffer_tail + m_buffer_size) % m_buffer->size()] = ch;
m_buffer_size++;
epoll_notify(EPOLLIN);
m_buffer_blocker.unblock();
}
epoll_notify(EPOLLIN);
return true;
}
@ -130,10 +132,10 @@ namespace Kernel
m_buffer_size -= to_copy;
m_buffer_tail = (m_buffer_tail + to_copy) % m_buffer->size();
epoll_notify(EPOLLOUT);
m_buffer_lock.unlock(state);
epoll_notify(EPOLLOUT);
return to_copy;
}