Basavaraj Natikar
5a45ed1ae3
HID: amd_sfh: Fix for shift-out-of-bounds
...
commit 87854366176403438d01f368b09de3ec2234e0f5 upstream.
Shift operation of 'exp' and 'shift' variables exceeds the maximum number
of shift values in the u32 range leading to UBSAN shift-out-of-bounds.
...
[ 6.120512] UBSAN: shift-out-of-bounds in drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c:149:50
[ 6.120598] shift exponent 104 is too large for 64-bit type 'long unsigned int'
[ 6.120659] CPU: 4 PID: 96 Comm: kworker/4:1 Not tainted 6.4.0amd_1-next-20230519-dirty #10
[ 6.120665] Hardware name: AMD Birman-PHX/Birman-PHX, BIOS SFH_with_HPD_SEN.FD 04/05/2023
[ 6.120667] Workqueue: events amd_sfh_work_buffer [amd_sfh]
[ 6.120687] Call Trace:
[ 6.120690] <TASK>
[ 6.120694] dump_stack_lvl+0x48/0x70
[ 6.120704] dump_stack+0x10/0x20
[ 6.120707] ubsan_epilogue+0x9/0x40
[ 6.120716] __ubsan_handle_shift_out_of_bounds+0x10f/0x170
[ 6.120720] ? psi_group_change+0x25f/0x4b0
[ 6.120729] float_to_int.cold+0x18/0xba [amd_sfh]
[ 6.120739] get_input_rep+0x57/0x340 [amd_sfh]
[ 6.120748] ? __schedule+0xba7/0x1b60
[ 6.120756] ? __pfx_get_input_rep+0x10/0x10 [amd_sfh]
[ 6.120764] amd_sfh_work_buffer+0x91/0x180 [amd_sfh]
[ 6.120772] process_one_work+0x229/0x430
[ 6.120780] worker_thread+0x4a/0x3c0
[ 6.120784] ? __pfx_worker_thread+0x10/0x10
[ 6.120788] kthread+0xf7/0x130
[ 6.120792] ? __pfx_kthread+0x10/0x10
[ 6.120795] ret_from_fork+0x29/0x50
[ 6.120804] </TASK>
...
Fix this by adding the condition to validate shift ranges.
Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality")
Cc: stable@vger.kernel.org
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Link: https://lore.kernel.org/r/20230707065722.9036-3-Basavaraj.Natikar@amd.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-23 13:49:18 +02:00
..
2023-07-23 13:49:18 +02:00
2023-03-10 09:33:21 +01:00
2023-04-20 12:35:13 +02:00
2022-06-13 17:25:08 +02:00
2022-08-25 11:44:27 +02:00
2022-06-15 15:51:46 +02:00
2021-05-05 14:29:13 +02:00
2022-07-22 15:02:20 +02:00
2023-05-24 17:32:41 +01:00
2020-03-13 17:33:11 +01:00
2023-03-10 09:32:32 +01:00
2023-02-01 08:34:24 +01:00
2023-03-10 09:33:23 +01:00
2021-12-02 15:36:18 +01:00
2021-07-28 11:51:07 +02:00
2023-03-17 08:50:17 +01:00
2021-12-02 15:36:18 +01:00
2021-10-07 13:37:25 +02:00
2023-03-30 12:49:16 +02:00
2020-10-23 13:23:44 +02:00
2023-03-10 09:33:55 +01:00
2022-04-21 11:38:28 +02:00
2023-03-03 11:52:20 +01:00
2022-02-17 14:14:41 +01:00
2021-12-02 15:36:18 +01:00
2020-03-18 13:36:21 +01:00
2023-06-09 10:34:18 +02:00
2021-05-27 15:40:34 +02:00
2021-12-02 15:36:18 +01:00
2021-12-20 11:25:42 +01:00
2022-11-02 14:34:56 +01:00
2023-06-09 10:34:18 +02:00
2023-05-24 17:32:41 +01:00
2022-11-14 23:55:12 +01:00
2022-05-11 14:19:27 +02:00
2022-04-21 10:28:49 +02:00
2022-10-18 14:43:59 +02:00
2022-01-06 14:22:51 +01:00
2022-11-14 23:56:52 +01:00
2022-07-21 13:47:12 +02:00
2021-12-02 15:36:18 +01:00
2022-02-16 16:26:21 +01:00
2023-07-01 13:16:26 +02:00
2020-08-17 11:38:49 +02:00
2022-10-14 10:47:50 +01:00
2022-12-31 13:33:10 +01:00
2022-05-06 08:29:26 +02:00
2020-11-25 14:30:33 +01:00
2020-09-02 12:55:46 -07:00
2023-03-10 09:33:20 +01:00
2022-09-21 13:25:26 +01:00
2020-09-03 16:18:55 +02:00
2021-04-07 18:46:20 +02:00
2022-05-03 16:04:22 +02:00
2023-01-04 11:28:58 +01:00
2023-02-06 08:06:33 +01:00
2021-12-02 15:36:18 +01:00
2022-09-20 11:36:21 +01:00
2023-03-10 09:33:21 +01:00
2022-02-16 17:12:14 +01:00
2022-12-31 13:32:14 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-09-25 08:20:48 -07:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2021-12-02 15:36:18 +01:00
2022-09-20 14:49:15 +02:00
2022-10-18 14:42:45 +02:00
2021-12-02 15:36:18 +01:00
2021-05-05 14:21:08 +02:00
2022-12-31 13:32:14 +01:00
2021-05-05 14:36:18 +02:00
2022-02-02 15:12:22 +01:00
2022-09-20 11:27:29 +01:00
2022-10-05 10:19:06 +01:00
2022-08-25 11:38:55 +02:00
2021-12-14 10:50:23 +01:00
2022-09-20 12:16:25 +01:00
2021-12-02 15:35:57 +01:00
2023-03-10 09:33:57 +01:00
2022-08-25 10:26:31 +02:00
2023-03-10 09:33:57 +01:00
2023-03-10 09:33:56 +01:00
2022-08-25 10:26:31 +02:00
2022-12-31 13:33:00 +01:00
2022-12-31 13:33:00 +01:00
2020-07-20 12:24:41 +02:00
2022-05-11 14:19:27 +02:00
2022-08-25 11:37:21 +02:00
2022-08-25 11:37:21 +02:00
2022-08-25 11:37:21 +02:00
2022-09-20 11:35:00 +01:00
2021-01-07 10:14:58 +01:00
2020-06-19 14:17:22 +02:00
2020-06-19 14:17:22 +02:00
2021-09-22 11:53:07 +02:00
2023-07-01 13:16:26 +02:00
2023-07-19 16:21:28 +02:00
2022-10-05 10:34:48 +01:00
2023-03-17 08:50:17 +01:00
2023-06-28 11:12:35 +02:00
2023-07-01 13:16:26 +02:00
2023-07-01 13:16:26 +02:00
2022-08-25 11:32:31 +02:00