YueHaibing
3c3941bb1e
can: bcm: Fix UAF in bcm_proc_show()
...
commit 55c3b96074
upstream.
BUG: KASAN: slab-use-after-free in bcm_proc_show+0x969/0xa80
Read of size 8 at addr ffff888155846230 by task cat/7862
CPU: 1 PID: 7862 Comm: cat Not tainted 6.5.0-rc1-00153-gc8746099c197 #230
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xd5/0x150
print_report+0xc1/0x5e0
kasan_report+0xba/0xf0
bcm_proc_show+0x969/0xa80
seq_read_iter+0x4f6/0x1260
seq_read+0x165/0x210
proc_reg_read+0x227/0x300
vfs_read+0x1d5/0x8d0
ksys_read+0x11e/0x240
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Allocated by task 7846:
kasan_save_stack+0x1e/0x40
kasan_set_track+0x21/0x30
__kasan_kmalloc+0x9e/0xa0
bcm_sendmsg+0x264b/0x44e0
sock_sendmsg+0xda/0x180
____sys_sendmsg+0x735/0x920
___sys_sendmsg+0x11d/0x1b0
__sys_sendmsg+0xfa/0x1d0
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 7846:
kasan_save_stack+0x1e/0x40
kasan_set_track+0x21/0x30
kasan_save_free_info+0x27/0x40
____kasan_slab_free+0x161/0x1c0
slab_free_freelist_hook+0x119/0x220
__kmem_cache_free+0xb4/0x2e0
rcu_core+0x809/0x1bd0
bcm_op is freed before procfs entry be removed in bcm_release(),
this lead to bcm_proc_show() may read the freed bcm_op.
Fixes: ffd980f976
("[CAN]: Add broadcast manager (bcm) protocol")
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net >
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net >
Link: https://lore.kernel.org/all/20230715092543.15548-1-yuehaibing@huawei.com
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-07-27 08:46:55 +02:00
..
2021-07-22 16:19:03 +02:00
2023-04-20 12:13:53 +02:00
2022-12-31 13:14:42 +01:00
2023-05-24 17:36:52 +01:00
2021-07-23 14:20:25 +01:00
2023-06-09 10:32:26 +02:00
2022-06-22 14:22:01 +02:00
2023-06-14 11:13:04 +02:00
2023-06-14 11:13:06 +02:00
2022-12-31 13:14:11 +01:00
2023-07-23 13:47:29 +02:00
2023-03-17 08:48:54 +01:00
2023-07-27 08:46:55 +02:00
2023-07-23 13:47:53 +02:00
2023-07-23 13:47:41 +02:00
2022-03-08 19:12:52 +01:00
2023-04-26 13:51:54 +02:00
2023-07-23 13:47:30 +02:00
2021-08-03 13:05:26 +01:00
2023-05-17 11:50:18 +02:00
2023-04-05 11:25:02 +02:00
2022-11-03 23:59:14 +09:00
2023-07-23 13:47:29 +02:00
2023-07-23 13:47:42 +02:00
2023-03-22 13:31:28 +01:00
2022-11-26 09:24:50 +01:00
2023-05-24 17:36:49 +01:00
2023-04-26 13:51:54 +02:00
2022-04-27 14:38:53 +02:00
2023-05-24 17:36:42 +01:00
2023-06-09 10:32:25 +02:00
2022-12-14 11:37:25 +01:00
2023-02-06 07:59:02 +01:00
2023-02-22 12:57:09 +01:00
2023-07-05 18:25:04 +01:00
2023-05-17 11:50:16 +02:00
2023-07-23 13:47:37 +02:00
2022-04-13 20:59:10 +02:00
2023-07-23 13:46:56 +02:00
2023-06-09 10:32:16 +02:00
2023-07-23 13:46:56 +02:00
2023-05-24 17:36:51 +01:00
2023-02-22 12:57:09 +01:00
2023-06-09 10:32:17 +02:00
2022-01-11 15:35:16 +01:00
2023-04-20 12:13:53 +02:00
2023-03-10 09:39:16 +01:00
2022-04-08 14:23:00 +02:00
2023-02-22 12:57:02 +01:00
2023-05-17 11:50:17 +02:00
2023-07-23 13:47:58 +02:00
2023-07-23 13:47:27 +02:00
2023-06-14 11:13:01 +02:00
2021-11-18 19:17:11 +01:00
2023-07-23 13:47:20 +02:00
2021-08-04 12:35:07 +01:00
2023-06-21 15:59:18 +02:00
2023-05-24 17:36:42 +01:00
2023-05-24 17:36:42 +01:00
2023-05-24 17:36:49 +01:00
2023-07-23 13:46:53 +02:00
2023-02-09 11:26:40 +01:00
2023-07-23 13:47:29 +02:00
2023-06-28 10:29:45 +02:00
2023-06-21 15:59:15 +02:00
2023-06-21 15:59:15 +02:00
2023-05-24 17:36:42 +01:00