linux-stable/include
Schspa Shi 98f53e5919 mrp: introduce active flags to prevent UAF when applicant uninit
[ Upstream commit ab0377803d ]

The caller of del_timer_sync must prevent restarting of the timer, If
we have no this synchronization, there is a small probability that the
cancellation will not be successful.

And syzbot report the fellowing crash:
==================================================================
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:929 [inline]
BUG: KASAN: use-after-free in enqueue_timer+0x18/0xa4 kernel/time/timer.c:605
Write at addr f9ff000024df6058 by task syz-fuzzer/2256
Pointer tag: [f9], memory tag: [fe]

CPU: 1 PID: 2256 Comm: syz-fuzzer Not tainted 6.1.0-rc5-syzkaller-00008-
ge01d50cbd6ee #0
Hardware name: linux,dummy-virt (DT)
Call trace:
 dump_backtrace.part.0+0xe0/0xf0 arch/arm64/kernel/stacktrace.c:156
 dump_backtrace arch/arm64/kernel/stacktrace.c:162 [inline]
 show_stack+0x18/0x40 arch/arm64/kernel/stacktrace.c:163
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x68/0x84 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x1a8/0x4a0 mm/kasan/report.c:395
 kasan_report+0x94/0xb4 mm/kasan/report.c:495
 __do_kernel_fault+0x164/0x1e0 arch/arm64/mm/fault.c:320
 do_bad_area arch/arm64/mm/fault.c:473 [inline]
 do_tag_check_fault+0x78/0x8c arch/arm64/mm/fault.c:749
 do_mem_abort+0x44/0x94 arch/arm64/mm/fault.c:825
 el1_abort+0x40/0x60 arch/arm64/kernel/entry-common.c:367
 el1h_64_sync_handler+0xd8/0xe4 arch/arm64/kernel/entry-common.c:427
 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:576
 hlist_add_head include/linux/list.h:929 [inline]
 enqueue_timer+0x18/0xa4 kernel/time/timer.c:605
 mod_timer+0x14/0x20 kernel/time/timer.c:1161
 mrp_periodic_timer_arm net/802/mrp.c:614 [inline]
 mrp_periodic_timer+0xa0/0xc0 net/802/mrp.c:627
 call_timer_fn.constprop.0+0x24/0x80 kernel/time/timer.c:1474
 expire_timers+0x98/0xc4 kernel/time/timer.c:1519

To fix it, we can introduce a new active flags to make sure the timer will
not restart.

Reported-by: syzbot+6fd64001c20aa99e34a4@syzkaller.appspotmail.com

Signed-off-by: Schspa Shi <schspa@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-07 12:07:32 +01:00
..
acpi ACPI: scan: Use unique number for instance_no 2021-03-30 14:41:41 +02:00
asm-generic mm/khugepaged: fix GUP-fast interaction by sending IPI 2023-01-07 12:07:10 +01:00
clocksource
crypto crypto: drbg - make reseeding from get_random_bytes() synchronous 2022-06-25 11:45:16 +02:00
drm drm: fix EDID struct for old ARM OABI format 2022-06-14 16:52:30 +02:00
dt-bindings
keys
kvm
linux eventfd: change int to __u64 in eventfd_signal() ifndef CONFIG_EVENTFD 2023-01-07 12:07:15 +01:00
math-emu
media media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros 2020-02-28 15:42:24 +01:00
memory
misc
net mrp: introduce active flags to prevent UAF when applicant uninit 2023-01-07 12:07:32 +01:00
pcmcia
ras
rdma IB/cma: Fix reference count leak when no ipv4 addresses are set 2020-06-03 08:16:33 +02:00
rxrpc
scsi scsi: stex: Properly zero out the passthrough command structure 2022-10-26 13:15:35 +02:00
soc irqchip/eznps: Fix build error for !ARC700 builds 2020-09-23 08:46:10 +02:00
sound ALSA: core: Add async signal helpers 2022-08-25 11:09:31 +02:00
target scsi: target: Fix ordered tag handling 2021-11-26 11:48:41 +01:00
trace spmi: trace: fix stack-out-of-bound access in SPMI tracing functions 2022-08-25 11:09:25 +02:00
uapi include/uapi/linux/swab: Fix potentially missing __always_inline 2023-01-07 12:07:28 +01:00
video video: of_display_timing.h: include errno.h 2022-07-12 16:26:24 +02:00
xen xen/gnttab: fix gnttab_end_foreign_access() without page specified 2022-03-11 10:03:33 +01:00
Kbuild