Vladis Dronov 13054abbaa HID: debug: fix the ring buffer implementation
Ring buffer implementation in hid_debug_event() and hid_debug_events_read()
is strange allowing lost or corrupted data. After commit 717adfdaf147
("HID: debug: check length before copy_to_user()") it is possible to enter
an infinite loop in hid_debug_events_read() by providing 0 as count, this
locks up a system. Fix this by rewriting the ring buffer implementation
with kfifo and simplify the code.

This fixes CVE-2019-3819.

v2: fix an execution logic and add a comment
v3: use __set_current_state() instead of set_current_state()

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1669187
Cc: stable@vger.kernel.org # v4.18+
Fixes: cd667ce24796 ("HID: use debugfs for events/reports dumping")
Fixes: 717adfdaf147 ("HID: debug: check length before copy_to_user()")
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2019-01-29 12:09:11 +01:00
..
2015-10-21 13:15:53 +02:00
2013-01-03 10:27:31 +01:00
2014-08-21 10:43:28 -05:00
2017-11-24 14:40:23 +01:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:44 +01:00
2013-04-24 16:32:27 +02:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:44 +01:00
2013-01-03 10:27:31 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2013-01-03 10:27:31 +01:00
2015-05-07 10:47:53 +02:00
2015-12-28 13:41:44 +01:00
2014-08-21 10:43:28 -05:00
2013-01-03 10:27:31 +01:00
2013-01-03 10:27:31 +01:00
2018-11-01 08:42:21 -07:00