mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
Kernel/HID: Take a spinlock when calling KeyboardClient::on_key_pressed
The KeyboardClient class member could be updated due to TTY switch, so we must ensure we always use a valid pointer.
This commit is contained in:
parent
b8493bf70f
commit
cd08c4a5aa
3 changed files with 14 additions and 3 deletions
|
@ -75,6 +75,12 @@ static constexpr Keyboard::CharacterMapData DEFAULT_CHARACTER_MAP =
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
void HIDManagement::set_client(KeyboardClient* client)
|
||||
{
|
||||
SpinlockLocker locker(m_client_lock);
|
||||
m_client = client;
|
||||
}
|
||||
|
||||
size_t HIDManagement::generate_minor_device_number_for_mouse()
|
||||
{
|
||||
// FIXME: Lock this to prevent race conditions with hot-plugging devices!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue