Zheyu Ma
030fadb013
video: fbdev: neofb: add a check against divide error
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 of the 'PICOS2KHZ' macro.
Fix this by checking whether 'pixclock' is zero first.
The following log reveals it:
[ 53.093806] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
[ 53.093838] CPU: 3 PID: 11763 Comm: hang Not tainted 5.14.0-rc2-00478-g2734d6c1b1a0 #215
[ 53.093859] RIP: 0010:neofb_check_var+0x80/0xe50
[ 53.093951] Call Trace:
[ 53.093956] ? neofb_setcolreg+0x2b0/0x2b0
[ 53.093968] fb_set_var+0x2e4/0xeb0
[ 53.093977] ? fb_blank+0x1a0/0x1a0
[ 53.093984] ? lock_acquire+0x1ef/0x530
[ 53.093996] ? lock_release+0x810/0x810
[ 53.094005] ? lock_is_held_type+0x100/0x140
[ 53.094016] ? ___might_sleep+0x1ee/0x2d0
[ 53.094028] ? __mutex_lock+0x620/0x1190
[ 53.094036] ? do_fb_ioctl+0x313/0x700
[ 53.094044] ? mutex_lock_io_nested+0xfa0/0xfa0
[ 53.094051] ? __this_cpu_preempt_check+0x1d/0x30
[ 53.094060] ? _raw_spin_unlock_irqrestore+0x46/0x60
[ 53.094069] ? lockdep_hardirqs_on+0x59/0x100
[ 53.094076] ? _raw_spin_unlock_irqrestore+0x46/0x60
[ 53.094085] ? trace_hardirqs_on+0x6a/0x1c0
[ 53.094096] 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/1626871424-27708-1-git-send-email-zheyuma97@gmail.com
2021-07-21 15:02:03 +02:00
..
2021-04-26 11:20:10 -07:00
2021-05-15 08:32:51 -07:00
2021-05-13 20:35:26 +02:00
2021-05-05 13:24:11 -07:00
2021-05-07 16:01:08 -07:00
2021-05-07 00:26:34 -07:00
2021-05-16 10:13:14 -07:00
2021-04-18 09:36:56 +03:00
2021-05-15 08:52:30 -07:00
2021-04-29 11:57:23 -07:00
2021-04-26 12:11:52 -07:00
2021-05-13 18:58:44 +02:00
2021-05-20 06:31:52 -10:00
2021-05-11 08:47:25 +02:00
2021-05-14 14:55:13 +02:00
2021-04-15 09:26:25 +02:00
2021-05-15 10:24:48 -07:00
2021-04-08 20:05:49 +02:00
2021-05-13 17:23:05 +02:00
2021-04-16 18:21:56 -07:00
2021-04-08 13:14:51 +09:00
2021-05-13 18:32:29 +02:00
2021-07-20 12:59:55 +02:00
2021-05-10 07:51:38 +02:00
2021-04-28 15:59:13 -07:00
2021-04-26 09:43:16 -07:00
2021-07-21 12:04:56 +02:00
2021-04-26 12:11:52 -07:00
2021-05-12 13:56:43 +02:00
2021-07-21 12:04:56 +02:00
2021-04-16 07:26:50 +02:00
2021-04-29 21:47:22 +02:00
2021-04-16 00:14:49 +02:00
2021-04-27 18:09:44 -07:00
2021-05-20 06:31:52 -10:00
2021-05-01 10:14:08 -07:00
2021-04-30 13:01:02 -07:00
2021-04-24 22:21:01 +02:00
2021-04-08 19:18:07 +02:00
2021-05-10 14:01:48 +01:00
2021-06-07 15:41:50 +02:00
2021-05-06 23:37:55 -07:00
2021-04-27 10:16:46 -07:00
2021-05-05 13:24:11 -07:00
2021-05-16 13:07:18 +01:00
2021-05-13 18:32:23 +02:00
2021-05-13 17:30:15 +02:00
2021-04-13 09:16:12 -06:00
2021-04-16 23:57:51 +10:00
2021-04-28 16:10:33 -07:00
2021-05-13 14:53:49 -04:00
2021-05-13 18:58:32 +02:00
2021-05-02 00:43:35 +09:00
2021-04-26 11:08:23 +02:00
2021-04-13 01:39:12 -04:00
2021-04-28 15:59:13 -07:00
2021-05-20 06:40:20 -10:00
2021-05-10 14:39:06 +02:00
2021-04-26 11:14:21 -07:00
2021-05-04 18:08:40 -07:00
2021-04-02 16:28:53 +02:00
2021-05-13 18:58:42 +02:00
2021-04-13 14:50:57 -07:00
2021-05-06 19:24:11 -07:00
2021-05-19 08:40:24 +02:00
2021-04-02 16:28:10 +02:00
2021-05-03 13:57:56 -05:00
2021-05-07 00:26:34 -07:00
2021-05-19 23:50:27 -04:00
2021-05-01 10:14:08 -07:00
2021-04-29 11:57:23 -07:00
2021-05-09 00:29:45 +09:00
2021-05-20 14:11:03 +02:00
2021-04-28 15:43:58 -07:00
2021-04-26 11:20:10 -07:00
2021-05-01 10:14:08 -07:00
2021-05-05 12:53:16 -07:00
2021-05-13 18:32:19 +02:00
2021-04-07 11:52:26 +02:00
2021-04-28 15:59:13 -07:00
2021-05-04 11:13:33 -07:00
2021-05-05 13:24:11 -07:00
2021-04-09 11:08:42 -05:00
2021-05-03 12:15:21 -07:00
2021-05-07 11:35:12 -07:00
2021-05-20 14:41:35 -10:00
2021-04-26 09:43:16 -07:00
2021-05-01 09:33:00 -07:00
2021-04-06 10:26:44 +05:30
2021-04-30 12:48:14 -07:00
2021-05-10 14:26:24 +02:00
2021-05-08 10:44:36 -07:00
2021-05-17 16:06:02 +02:00
2021-05-05 12:46:48 -07:00
2021-04-13 12:17:14 +02:00
2021-05-20 06:31:52 -10:00
2021-05-14 13:26:04 +02:00
2021-05-16 10:13:14 -07:00
2021-05-03 04:55:54 -04:00
2021-07-21 10:29:10 +02:00
2021-05-05 13:31:39 -07:00
2021-07-21 15:02:03 +02:00
2021-04-29 19:06:49 +02:00
2021-05-04 04:19:59 -04:00
2021-04-10 10:58:21 +02:00
2021-04-28 15:59:13 -07:00
2021-05-21 09:55:16 +02:00
2021-04-15 09:26:25 +02:00
2021-05-05 13:31:39 -07:00