mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-08-18 11:27:28 +00:00
HID: roccat: fix use-after-free in roccat_report_event
[ Upstream commit d802d848308b35220f21a8025352f0c0aba15c12 ] roccat_report_event() iterates over the device->readers list without holding the readers_lock. This allows a concurrent roccat_release() to remove and free a reader while it's still being accessed, leading to a use-after-free. Protect the readers list traversal with the readers_lock mutex. Signed-off-by: Benoît Sevens <bsevens@google.com> Reviewed-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
This commit is contained in:
committed by
Ulrich Hecht
parent
03e50cecb0
commit
3cf7bce0f0
@ -260,6 +260,7 @@ int roccat_report_event(int minor, u8 const *data)
|
||||
if (!new_value)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_lock(&device->readers_lock);
|
||||
mutex_lock(&device->cbuf_lock);
|
||||
|
||||
report = &device->cbuf[device->cbuf_end];
|
||||
@ -282,6 +283,7 @@ int roccat_report_event(int minor, u8 const *data)
|
||||
}
|
||||
|
||||
mutex_unlock(&device->cbuf_lock);
|
||||
mutex_unlock(&device->readers_lock);
|
||||
|
||||
wake_up_interruptible(&device->wait);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user