Zheyu Ma
d768c00621
video: fbdev: riva: Error out if 'pixclock' equals zero
[ Upstream commit f92763cb0feba247e0939ed137b495601fd072a5 ]
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:43:05 +02:00
..
2021-08-26 08:37:22 -04:00
2021-03-03 17:44:38 +01:00
2020-08-21 11:01:55 +02:00
2021-09-22 11:43:03 +02:00
2021-07-20 16:21:08 +02:00
2021-09-22 11:42:58 +02:00
2021-09-22 11:43:02 +02:00
2021-09-22 11:42:55 +02:00
2021-07-20 16:21:08 +02:00
2021-05-22 10:40:23 +02:00
2021-05-26 11:29:07 +02:00
2021-07-20 16:21:14 +02:00
2021-09-22 11:43:02 +02:00
2021-03-03 17:44:37 +01:00
2021-01-17 13:57:54 +01:00
2020-06-20 10:24:18 +02:00
2021-09-22 11:43:04 +02:00
2020-10-01 20:40:02 +02:00
2021-08-26 08:37:26 -04:00
2019-12-21 10:42:32 +01:00
2020-10-29 09:05:32 +01:00
2021-07-20 16:21:05 +02:00
2021-04-07 12:05:40 +02:00
2021-07-20 16:21:09 +02:00
2021-07-20 16:21:12 +02:00
2021-09-22 11:43:00 +02:00
2021-06-30 08:49:11 -04:00
2021-05-22 10:40:26 +02:00
2021-05-22 10:40:24 +02:00
2021-07-20 16:21:01 +02:00
2021-05-22 10:40:16 +02:00
2021-09-22 11:43:02 +02:00
2020-09-12 11:47:36 +02:00
2021-09-22 11:43:04 +02:00
2021-09-03 09:44:40 +02:00
2021-07-20 16:21:04 +02:00
2021-08-04 11:58:01 +02:00
2021-08-26 08:37:28 -04:00
2020-12-29 13:45:00 +01:00
2021-07-20 16:21:06 +02:00
2021-07-20 16:21:05 +02:00
2020-06-20 10:24:21 +02:00
2021-07-20 16:21:10 +02:00
2021-09-22 11:43:03 +02:00
2021-07-20 16:21:15 +02:00
2020-12-29 13:44:58 +01:00
2020-11-10 10:23:57 +01:00
2021-07-20 16:21:11 +02:00
2021-09-22 11:43:03 +02:00
2021-09-22 11:43:01 +02:00
2021-09-22 11:42:55 +02:00
2021-09-22 11:43:02 +02:00
2021-08-04 11:58:03 +02:00
2020-10-29 09:05:41 +01:00
2021-03-03 17:44:44 +01:00
2021-09-22 11:42:57 +02:00
2020-06-11 09:22:22 +02:00
2021-07-20 16:21:05 +02:00
2020-08-21 11:02:06 +02:00
2020-01-04 13:39:55 +01:00
2021-09-22 11:43:04 +02:00
2021-08-15 13:01:03 +02:00
2021-07-20 16:21:05 +02:00
2021-09-22 11:43:04 +02:00
2021-07-20 16:21:00 +02:00
2021-09-22 11:43:03 +02:00
2020-11-10 21:04:57 +01:00
2020-12-29 13:45:00 +01:00
2020-05-20 08:15:33 +02:00
2021-07-20 16:21:14 +02:00
2021-05-26 11:29:06 +02:00
2021-07-20 16:20:59 +02:00
2021-02-23 13:59:14 +01:00
2021-07-28 09:14:24 +02:00
2021-09-22 11:43:02 +02:00
2021-07-20 16:21:11 +02:00
2021-08-26 08:37:26 -04:00
2021-09-22 11:43:00 +02:00
2021-09-22 11:42:59 +02:00
2021-07-20 16:20:57 +02:00
2021-09-22 11:43:05 +02:00
2021-07-28 09:14:27 +02:00
2021-07-28 09:14:25 +02:00
2021-09-22 11:43:05 +02:00
2020-07-22 09:10:53 +02:00
2021-09-22 11:43:05 +02:00
2021-09-22 11:43:04 +02:00
2021-09-03 09:44:40 +02:00
2021-09-22 11:43:05 +02:00
2020-10-29 09:05:35 +01:00
2021-09-03 09:44:40 +02:00
2020-02-28 15:42:33 +01:00
2020-11-10 10:23:57 +01:00
2021-07-20 16:21:14 +02:00
2021-08-26 08:37:23 -04:00