Zheyu Ma
f1c423e9ca
video: fbdev: riva: Error out if 'pixclock' equals zero
[ Upstream commit f92763cb0f ]
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.
Fix this by checking whether 'pixclock' is zero first.
The following log reveals it:
[ 33.396850] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
[ 33.396864] CPU: 5 PID: 11754 Comm: i740 Not tainted 5.14.0-rc2-00513-gac532c9bbcfb-dirty #222
[ 33.396883] RIP: 0010:riva_load_video_mode+0x417/0xf70
[ 33.396969] Call Trace:
[ 33.396973] ? debug_smp_processor_id+0x1c/0x20
[ 33.396984] ? tick_nohz_tick_stopped+0x1a/0x90
[ 33.396996] ? rivafb_copyarea+0x3c0/0x3c0
[ 33.397003] ? wake_up_klogd.part.0+0x99/0xd0
[ 33.397014] ? vprintk_emit+0x110/0x4b0
[ 33.397024] ? vprintk_default+0x26/0x30
[ 33.397033] ? vprintk+0x9c/0x1f0
[ 33.397041] ? printk+0xba/0xed
[ 33.397054] ? record_print_text.cold+0x16/0x16
[ 33.397063] ? __kasan_check_read+0x11/0x20
[ 33.397074] ? profile_tick+0xc0/0x100
[ 33.397084] ? __sanitizer_cov_trace_const_cmp4+0x24/0x80
[ 33.397094] ? riva_set_rop_solid+0x2a0/0x2a0
[ 33.397102] rivafb_set_par+0xbe/0x610
[ 33.397111] ? riva_set_rop_solid+0x2a0/0x2a0
[ 33.397119] fb_set_var+0x5bf/0xeb0
[ 33.397127] ? fb_blank+0x1a0/0x1a0
[ 33.397134] ? lock_acquire+0x1ef/0x530
[ 33.397143] ? lock_release+0x810/0x810
[ 33.397151] ? lock_is_held_type+0x100/0x140
[ 33.397159] ? ___might_sleep+0x1ee/0x2d0
[ 33.397170] ? __mutex_lock+0x620/0x1190
[ 33.397180] ? trace_hardirqs_on+0x6a/0x1c0
[ 33.397190] do_fb_ioctl+0x31e/0x700
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-4-git-send-email-zheyuma97@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-22 11:48:04 +02:00
..
2020-10-29 09:55:09 +01:00
2021-09-22 11:47:56 +02:00
2018-02-15 01:15:52 +01:00
2017-11-02 11:10:55 +01:00
2018-01-17 08:16:46 -06:00
2021-09-22 11:48:04 +02:00
2018-03-28 16:34:28 +02:00
2018-06-12 16:19:22 -07:00
2017-11-02 11:10:55 +01:00
2018-06-17 05:00:24 +09:00
2018-06-17 05:00:24 +09:00
2018-07-24 19:11:28 +02:00
2020-09-03 11:24:20 +02:00
2021-09-22 11:48:04 +02:00
2018-04-24 18:11:21 +02:00
2020-10-29 09:55:09 +01:00
2018-03-12 17:06:54 +01:00
2018-07-24 19:11:28 +02:00
2017-09-04 16:00:49 +02:00
2017-04-07 17:03:24 +02:00
2017-02-25 13:20:22 -08:00
2017-11-02 11:10:55 +01:00
2017-01-30 17:39:48 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 16:34:29 +02:00
2018-07-31 13:06:58 +02:00
2017-04-20 12:02:32 +01:00
2017-08-01 17:20:42 +02:00
2021-09-22 11:48:04 +02:00
2017-11-02 11:10:55 +01:00
2016-02-26 13:28:35 +02:00
2017-11-02 11:10:55 +01:00
2020-12-30 11:25:54 +01:00
2018-06-17 05:00:24 +09:00
2014-07-30 14:10:39 +02:00
2018-05-15 12:41:11 +02:00
2018-01-04 16:53:49 +01:00
2018-06-12 16:19:22 -07:00
2016-02-26 13:06:11 +02:00
2016-02-26 13:06:11 +02:00
2017-08-07 17:22:13 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-07 17:22:13 +02:00
2017-08-07 17:22:13 +02:00
2017-08-07 17:22:13 +02:00
2020-01-27 14:50:21 +01:00
2017-11-09 18:09:32 +01:00
2019-02-12 19:47:15 +01:00
2014-10-20 16:21:51 +02:00
2017-08-01 17:20:39 +02:00
2015-03-23 14:29:40 +11:00
2017-11-09 18:09:33 +01:00
2017-09-04 16:00:49 +02:00
2017-08-01 17:20:39 +02:00
2017-11-09 18:09:31 +01:00
2020-08-26 10:31:05 +02:00
2016-03-09 14:57:51 +01:00
2017-09-04 16:00:50 +02:00
2017-08-07 17:22:13 +02:00
2017-09-04 16:00:49 +02:00
2018-07-24 19:11:26 +02:00
2016-03-09 14:57:51 +01:00
2018-07-24 19:11:27 +02:00
2017-09-04 16:00:49 +02:00
2015-10-08 12:19:39 +03:00
2016-09-27 11:16:35 +03:00
2021-05-26 11:48:35 +02:00
2016-12-24 11:46:01 -08:00
2017-05-27 15:41:17 -04:00
2021-01-12 20:10:20 +01:00
2018-07-24 19:11:28 +02:00
2021-05-26 11:48:34 +02:00
2018-06-12 16:19:22 -07:00
2017-05-22 17:22:06 +02:00
2021-03-04 09:39:38 +01:00
2017-08-07 17:22:13 +02:00
2018-01-16 16:47:29 +01:00
2018-05-14 15:47:30 +02:00
2017-09-04 16:00:50 +02:00
2018-07-24 19:11:26 +02:00
2016-12-24 11:46:01 -08:00
2018-06-12 16:19:22 -07:00
2017-04-20 12:02:32 +01:00
2020-08-19 08:14:51 +02:00
2016-03-09 14:57:51 +01:00
2016-01-29 13:34:07 +02:00
2018-03-12 17:06:54 +01:00
2017-08-07 17:22:13 +02:00
2015-03-23 14:29:40 +11:00
2018-07-24 19:11:28 +02:00
2017-08-01 17:20:45 +02:00
2017-09-04 16:00:50 +02:00
2017-09-04 16:00:50 +02:00
2017-09-04 16:00:50 +02:00
2017-09-04 16:00:49 +02:00
2020-11-05 11:08:39 +01:00
2018-07-24 19:11:25 +02:00
2017-11-02 11:10:55 +01:00
2020-02-24 08:34:36 +01:00
2017-11-02 11:10:55 +01:00
2020-08-19 08:14:54 +02:00
2018-07-24 19:11:26 +02:00
2017-09-04 16:00:50 +02:00
2018-03-26 15:56:46 +02:00
2016-08-11 17:54:55 +03:00
2016-08-11 17:54:55 +03:00
2018-03-28 16:34:29 +02:00
2017-08-01 17:20:45 +02:00
2017-10-17 16:01:13 +02:00
2017-10-17 16:01:13 +02:00
2019-11-24 08:20:36 +01:00
2017-11-02 11:10:55 +01:00
2014-10-20 16:21:51 +02:00
2018-05-14 15:47:30 +02:00
2018-05-14 15:47:30 +02:00
2018-07-03 17:43:09 +02:00
2018-06-15 18:10:01 -03:00
2018-04-26 12:24:18 +02:00
2019-05-25 18:23:36 +02:00
2020-08-19 08:14:54 +02:00
2018-03-28 16:34:28 +02:00
2019-10-07 18:56:30 +02:00
2017-11-02 11:10:55 +01:00
2018-09-26 18:50:54 +02:00
2017-08-01 17:20:43 +02:00
2017-08-07 17:22:13 +02:00
2017-08-01 17:20:41 +02:00
2017-08-07 17:22:13 +02:00
2018-07-24 19:11:28 +02:00
2018-07-24 19:11:28 +02:00
2021-03-07 12:18:55 +01:00
2018-06-12 16:19:22 -07:00
2014-09-30 13:06:01 +03:00
2015-06-16 09:42:11 +03:00
2018-01-04 16:53:50 +01:00
2020-10-29 09:55:09 +01:00
2017-12-29 19:48:44 +01:00
2017-08-18 19:56:40 +02:00
2020-06-22 09:05:06 +02:00
2017-12-29 19:48:43 +01:00
2014-10-20 16:21:51 +02:00
2017-11-02 11:10:55 +01:00
2018-06-12 16:19:22 -07:00
2017-08-21 16:49:57 +02:00