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
..
2019-01-14 12:17:51 +01:00
2019-01-03 12:50:28 +01:00
2018-10-26 17:06:24 +02:00
2013-07-31 10:12:28 +02:00
2017-03-21 15:03:55 +01:00
2018-10-26 17:27:13 +02:00
2018-08-28 13:52:50 +02:00
2017-11-21 15:57:07 -08:00
2018-12-17 11:10:39 +01:00
2015-10-21 13:15:53 +02:00
2013-11-12 19:06:23 +01:00
2013-01-03 10:27:31 +01:00
2014-12-22 15:00:25 +01:00
2018-09-24 11:49:32 +02:00
2014-08-21 10:43:28 -05:00
2017-06-08 13:47:52 +02:00
2016-03-02 10:31:36 +01:00
2019-01-16 14:29:48 +01:00
2018-02-16 13:38:16 +01:00
2018-11-21 14:41:43 +01:00
2018-12-14 14:24:33 +01:00
2017-01-06 16:06:43 +01:00
2019-01-29 12:09:11 +01:00
2016-10-10 10:52:01 +02:00
2018-10-09 13:32:06 +02:00
2018-03-06 15:15:47 +01:00
2017-11-24 14:40:23 +01:00
2013-02-25 13:26:41 +01:00
2013-01-03 10:27:31 +01:00
2013-02-25 13:26:41 +01:00
2015-08-18 15:03:43 +02:00
2018-04-26 14:17:31 +02:00
2018-04-26 14:17:31 +02:00
2018-10-09 10:43:39 +02:00
2015-12-28 13:41:44 +01:00
2013-01-03 10:27:31 +01:00
2013-01-03 10:27:31 +01:00
2014-09-08 09:48:56 +02:00
2017-12-01 09:31:36 +01:00
2018-12-04 08:47:04 -08:00
2013-04-24 16:32:27 +02:00
2019-01-14 12:17:51 +01:00
2018-12-07 16:27:13 +01:00
2018-11-30 14:12:07 +01:00
2017-11-21 12:54:58 +01:00
2013-01-03 10:27:31 +01:00
2013-01-03 10:27:31 +01:00
2017-02-27 18:43:47 -08:00
2013-01-03 10:27:31 +01:00
2016-10-10 10:47:03 +02:00
2019-01-03 11:30:08 +01:00
2013-10-09 12:06:02 +02:00
2013-09-13 15:12:39 +02:00
2017-10-19 13:52:38 +02:00
2017-11-02 11:10:55 +01:00
2017-09-06 10:58:54 +02:00
2017-11-02 11:10:55 +01:00
2013-09-13 15:12:39 +02:00
2017-04-06 14:36:36 +02:00
2018-12-07 16:27:16 +01:00
2018-10-03 10:57:58 +02:00
2017-01-11 22:12:44 +01:00
2018-09-05 10:19:43 +02:00
2014-08-21 10:43:28 -05:00
2018-11-19 16:26:59 +01:00
2017-03-06 13:16:33 +01:00
2018-06-25 15:16:11 +02:00
2017-07-24 17:38:21 +02:00
2016-03-10 17:17:26 +01:00
2014-08-21 10:43:28 -05:00
2015-06-29 14:51:12 +02:00
2018-10-04 14:22:27 -04:00
2014-08-27 23:27:10 +02:00
2017-03-24 15:45:04 +01:00
2018-06-12 16:19:22 -07:00
2015-06-29 14:51:12 +02:00
2015-12-28 13:41:44 +01:00
2013-04-30 10:19:07 +02:00
2013-09-04 11:58:32 +02:00
2018-05-16 11:06:40 +02:00
2013-01-03 10:27:31 +01:00
2017-11-21 15:57:07 -08:00
2018-12-07 14:12:34 +01:00
2018-06-25 15:23:40 +02:00
2017-06-22 14:44:11 +02:00
2018-05-30 08:55:33 +02:00
2015-12-28 13:41:51 +01:00
2015-12-28 13:41:51 +01:00
2013-10-30 14:17:31 +01:00
2015-12-28 13:41:51 +01:00
2013-03-14 11:50:49 +01:00
2015-12-28 13:41:51 +01:00
2013-04-08 10:33:13 +02:00
2015-12-28 13:41:51 +01:00
2012-11-18 22:58:28 +01:00
2013-10-30 14:17:31 +01:00
2018-01-23 15:46:58 +01:00
2012-11-12 15:30:29 +01:00
2015-12-28 13:41:51 +01:00
2012-10-17 10:44:47 +02:00
2015-12-28 13:41:51 +01:00
2012-11-12 15:30:28 +01:00
2013-10-30 14:17:31 +01:00
2013-10-30 14:17:31 +01:00
2013-10-30 14:17:31 +01:00
2018-02-11 14:34:03 -08:00
2018-08-30 10:58:44 +02:00
2013-01-03 10:27:31 +01:00
2018-11-16 11:42:12 +00:00
2018-11-16 11:42:12 +00:00
2015-05-07 10:47:53 +02:00
2018-07-09 15:14:08 +02:00
2013-08-26 13:51:10 +02:00
2018-11-19 16:19:51 +01:00
2015-12-28 13:41:44 +01:00
2014-08-21 10:43:28 -05:00
2015-03-15 10:04:27 -04:00
2017-11-07 10:04:46 +01:00
2013-01-03 10:27:31 +01:00
2013-01-03 10:27:31 +01:00
2018-03-23 15:44:57 +01:00
2016-11-15 14:23:17 +01:00
2016-09-19 14:32:21 +02:00
2018-06-25 15:26:06 +02:00
2013-06-03 11:07:06 +02:00
2018-06-25 15:26:06 +02:00
2018-06-25 15:26:06 +02:00
2017-03-24 15:43:03 +01:00
2013-09-13 15:11:34 +02:00
2013-07-31 10:12:28 +02:00
2018-11-12 12:44:03 +01:00
2018-11-01 08:42:21 -07:00
2018-09-24 11:49:32 +02:00
2018-11-19 14:32:27 +01:00
2018-08-20 18:12:42 +02:00
2018-10-11 14:32:01 +02:00
2018-03-07 15:21:44 +01:00
2017-05-05 21:46:10 +02:00