Zheyu Ma
23a64dd9c8
video: fbdev: kyro: Error out if 'pixclock' equals zero
[ Upstream commit 1520b4b7ba ]
The userspace program could pass any values to the driver through
ioctl() interface. if the driver doesn't check the value of 'pixclock',
it may cause divide error because the value of 'lineclock' and
'frameclock' will be zero.
Fix this by checking whether 'pixclock' is zero in kyrofb_check_var().
The following log reveals it:
[ 103.073930] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
[ 103.073942] CPU: 4 PID: 12483 Comm: syz-executor Not tainted 5.14.0-rc2-00478-g2734d6c1b1a0-dirty #118
[ 103.073959] RIP: 0010:kyrofb_set_par+0x316/0xc80
[ 103.074045] Call Trace:
[ 103.074048] ? ___might_sleep+0x1ee/0x2d0
[ 103.074060] ? kyrofb_ioctl+0x330/0x330
[ 103.074069] fb_set_var+0x5bf/0xeb0
[ 103.074078] ? fb_blank+0x1a0/0x1a0
[ 103.074085] ? lock_acquire+0x3bd/0x530
[ 103.074094] ? lock_release+0x810/0x810
[ 103.074103] ? ___might_sleep+0x1ee/0x2d0
[ 103.074114] ? __mutex_lock+0x620/0x1190
[ 103.074126] ? trace_hardirqs_on+0x6a/0x1c0
[ 103.074137] do_fb_ioctl+0x31e/0x700
[ 103.074144] ? fb_getput_cmap+0x280/0x280
[ 103.074152] ? rcu_read_lock_sched_held+0x11/0x80
[ 103.074162] ? rcu_read_lock_sched_held+0x11/0x80
[ 103.074171] ? __sanitizer_cov_trace_switch+0x67/0xf0
[ 103.074181] ? __sanitizer_cov_trace_const_cmp2+0x20/0x80
[ 103.074191] ? do_vfs_ioctl+0x14b/0x16c0
[ 103.074199] ? vfs_fileattr_set+0xb60/0xb60
[ 103.074207] ? rcu_read_lock_sched_held+0x11/0x80
[ 103.074216] ? lock_release+0x483/0x810
[ 103.074224] ? __fget_files+0x217/0x3d0
[ 103.074234] ? __fget_files+0x239/0x3d0
[ 103.074243] ? do_fb_ioctl+0x700/0x700
[ 103.074250] fb_ioctl+0xe6/0x130
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-3-git-send-email-zheyuma97@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-22 11:43:05 +02:00
..
2018-11-21 09:26:00 +01:00
2021-09-22 11:43:02 +02:00
2018-02-22 15:43:55 +01:00
2016-09-27 11:08:15 +03:00
2016-09-07 11:16:05 +03:00
2021-09-22 11:43:05 +02:00
2016-09-27 11:43:24 +03:00
2016-08-30 12:00:15 +03:00
2014-07-01 13:32:30 +03:00
2018-02-25 11:05:44 +01:00
2015-06-03 12:41:50 +03:00
2018-09-26 08:36:32 +02:00
2020-09-03 11:21:17 +02:00
2015-12-15 15:41:23 +02:00
2016-09-27 11:16:35 +03:00
2020-10-29 09:05:35 +01:00
2015-11-06 17:50:42 -08:00
2018-09-26 08:36:32 +02:00
2014-06-24 10:55:13 +03:00
2016-03-09 14:57:51 +01:00
2016-08-30 11:54:23 +03:00
2016-08-11 17:54:54 +03:00
2016-11-03 12:20:14 +02:00
2016-08-11 17:54:54 +03:00
2018-03-22 09:17:48 +01:00
2015-06-23 16:23:30 -07:00
2016-09-27 11:16:35 +03:00
2015-08-25 09:59:45 +02:00
2021-09-22 11:43:05 +02:00
2016-02-26 13:28:35 +02:00
2018-02-22 15:43:49 +01:00
2016-02-26 13:28:35 +02:00
2014-07-30 14:10:39 +02:00
2017-12-20 10:07:27 +01:00
2015-12-15 15:41:23 +02:00
2014-10-20 16:21:51 +02:00
2014-10-20 16:21:51 +02:00
2014-10-20 16:21:51 +02:00
2016-02-26 13:28:35 +02:00
2016-08-30 12:06:12 +03:00
2016-08-02 19:35:05 -04:00
2014-10-20 16:21:51 +02:00
2015-09-30 10:33:57 +03:00
2016-02-26 13:06:11 +02:00
2016-02-26 13:06:11 +02:00
2014-10-20 16:21:51 +02:00
2014-10-20 16:21:51 +02:00
2014-10-20 16:21:51 +02:00
2014-10-20 16:21:51 +02:00
2020-01-29 10:24:15 +01:00
2019-02-12 19:44:56 +01:00
2014-10-20 16:21:51 +02:00
2017-08-06 18:59:48 -07:00
2015-03-23 14:29:40 +11:00
2017-12-20 10:07:27 +01:00
2014-09-30 13:06:01 +03:00
2016-05-27 15:26:11 -07:00
2018-11-10 07:42:45 -08:00
2016-03-09 14:57:51 +01:00
2014-05-23 13:51:10 +03:00
2014-10-20 16:21:51 +02:00
2015-12-09 12:57:06 +02:00
2016-03-09 14:57:51 +01:00
2019-04-03 06:24:14 +02:00
2014-10-20 16:21:51 +02:00
2015-10-08 12:19:39 +03:00
2016-09-27 11:16:35 +03:00
2021-05-26 11:29:09 +02:00
2014-10-20 16:21:51 +02:00
2015-06-07 15:28:57 +02:00
2021-01-12 19:49:03 +01:00
2016-09-27 11:16:35 +03:00
2021-05-26 11:29:07 +02:00
2016-05-10 11:42:25 +03:00
2021-03-03 17:44:34 +01:00
2014-10-20 16:21:51 +02:00
2016-09-27 11:05:29 +03:00
2016-02-16 14:52:43 +02:00
2016-08-30 11:57:21 +03:00
2016-08-30 11:59:33 +03:00
2016-02-26 12:16:58 +02:00
2020-08-21 11:01:58 +02:00
2016-03-09 14:57:51 +01:00
2016-01-29 13:34:07 +02:00
2016-09-27 10:55:02 +03:00
2014-10-20 16:21:51 +02:00
2015-03-23 14:29:40 +11:00
2016-09-27 11:16:35 +03:00
2015-06-03 12:41:52 +03:00
2016-02-26 13:06:11 +02:00
2017-11-15 15:53:11 +01:00
2020-11-10 10:23:53 +01:00
2015-08-10 12:25:43 +03:00
2020-02-28 15:42:17 +01:00
2020-08-21 11:02:00 +02:00
2015-12-15 15:41:24 +02:00
2016-09-27 11:16:35 +03:00
2016-08-11 17:54:55 +03:00
2016-08-11 17:54:55 +03:00
2016-03-09 14:57:51 +01:00
2015-08-25 09:59:45 +02:00
2016-03-09 14:57:51 +01:00
2014-12-05 16:30:25 +00:00
2019-11-25 09:53:41 +01:00
2014-10-20 16:21:51 +02:00
2015-04-07 16:24:15 +03:00
2014-12-18 20:28:33 -08:00
2016-09-27 11:21:36 +03:00
2016-02-26 13:28:35 +02:00
2018-03-24 11:00:21 +01:00
2019-05-25 18:26:52 +02:00
2020-08-21 11:01:59 +02:00
2016-09-27 11:47:37 +03:00
2019-10-07 18:53:09 +02:00
2015-08-10 23:07:05 -04:00
2016-03-03 13:36:51 +02:00
2016-03-03 13:36:51 +02:00
2016-03-03 13:36:51 +02:00
2014-10-20 16:21:51 +02:00
2016-09-27 11:16:35 +03:00
2015-11-10 10:00:09 -08:00
2018-03-24 11:00:21 +01:00
2018-07-03 11:23:16 +02:00
2014-09-30 13:06:01 +03:00
2015-06-16 09:42:11 +03:00
2018-04-13 19:48:10 +02:00
2020-10-29 09:05:35 +01:00
2015-01-13 13:35:04 +02:00
2015-08-25 09:59:45 +02:00
2020-06-20 10:24:11 +02:00
2014-10-20 16:21:51 +02:00
2014-10-20 16:21:51 +02:00
2017-04-21 09:31:21 +02:00
2014-10-20 16:21:51 +02:00