Zheyu Ma
26b5487c8b
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>
2023-05-16 11:45:48 +09:00
..
2023-05-15 09:27:03 +09:00
2023-05-16 11:44:58 +09: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
2023-05-16 11:45:47 +09: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
2023-05-15 08:19:23 +09:00
2023-05-16 08:56:51 +09:00
2023-05-16 11:45:48 +09:00
2016-09-27 11:16:35 +03:00
2023-05-16 09:38:11 +09:00
2015-11-06 17:50:42 -08:00
2023-05-15 08:19:26 +09: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
2023-05-16 11:45:45 +09: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
2023-05-15 16:43:44 +09:00
2023-05-15 11:23:10 +09: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
2023-05-15 09:12:14 +09: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
2023-05-15 08:19:24 +09: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
2023-05-16 11:05:59 +09:00
2014-10-20 16:21:51 +02:00
2015-06-07 15:28:57 +02:00
2023-05-16 10:25:09 +09:00
2016-09-27 11:16:35 +03:00
2023-05-16 11:05:35 +09:00
2016-05-10 11:42:25 +03:00
2023-05-16 10:37:06 +09: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
2023-05-16 08:45:54 +09: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
2023-05-16 09:44:38 +09:00
2015-08-10 12:25:43 +03:00
2023-05-15 16:58:05 +09:00
2023-05-16 08:46:15 +09: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
2023-05-15 15:12:20 +09: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
2023-05-15 12:53:12 +09:00
2023-05-16 08:46:12 +09:00
2016-09-27 11:47:37 +03:00
2023-05-15 14:40:43 +09: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
2023-05-16 09:38:10 +09:00
2015-01-13 13:35:04 +02:00
2015-08-25 09:59:45 +02:00
2023-05-15 17:32:45 +09: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