android_kernel_xiaomi_sm8350/net
Schspa Shi aadb1507a7 mrp: introduce active flags to prevent UAF when applicant uninit
[ Upstream commit ab0377803dafc58f1e22296708c1c28e309414d6 ]

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-18 11:41:37 +01:00
..
6lowpan
9p 9p/xen: check logical size for buffer size 2022-12-14 11:30:41 +01:00
802 mrp: introduce active flags to prevent UAF when applicant uninit 2023-01-18 11:41:37 +01:00
8021q
appletalk
atm net/atm: fix proc_mpc_write incorrect return value 2022-10-29 10:20:35 +02:00
ax25
batman-adv
bluetooth Bluetooth: RFCOMM: don't call kfree_skb() under spin_lock_irqsave() 2023-01-18 11:41:16 +01:00
bpf bpf: Move skb->len == 0 checks into __bpf_redirect 2023-01-18 11:41:04 +01:00
bpfilter
bridge netfilter: ebtables: fix memory leak when blob is malformed 2022-09-28 11:04:07 +02:00
caif net: caif: fix double disconnect client in chnl_net_open() 2022-11-25 17:42:15 +01:00
can can: af_can: fix NULL pointer dereference in can_rcv_filter 2022-12-14 11:30:44 +01:00
ceph
core net: add atomic_long_t to net_device_stats fields 2023-01-18 11:41:37 +01:00
dcb
dccp dccp/tcp: Reset saddr on failure after inet6?_hash_connect(). 2022-12-08 11:22:59 +01:00
decnet
dns_resolver
dsa net: dsa: ksz: Check return value 2022-12-14 11:30:45 +01:00
ethernet
hsr hsr: Avoid double remove of a node. 2023-01-18 11:41:09 +01:00
ieee802154 net: ieee802154: fix error return code in dgram_bind() 2022-11-03 23:56:54 +09:00
ife
ipv4 net/tunnel: wait until all sk_user_data reader finish before releasing the sock 2023-01-18 11:41:14 +01:00
ipv6 ipv6: avoid use-after-free in ip6_fragment() 2022-12-14 11:30:48 +01:00
iucv
kcm kcm: close race conditions on sk_receive_queue 2022-11-25 17:42:21 +01:00
key af_key: Fix send_acquire race with pfkey_register 2022-12-08 11:22:57 +01:00
l2tp ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg 2022-06-22 14:11:21 +02:00
l3mdev
lapb
llc
mac80211 wifi: mac80211: Fix ack frame idr leak when mesh has no route 2022-12-08 11:22:57 +01:00
mac802154 mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add() 2022-12-14 11:30:45 +01:00
mpls
ncsi
netfilter netfilter: conntrack: set icmpv6 redirects as RELATED 2023-01-18 11:41:08 +01:00
netlabel
netlink
netrom
nfc NFC: nci: Bounds check struct nfc_target arrays 2022-12-14 11:30:46 +01:00
nsh
openvswitch openvswitch: Fix flow lookup to use unmasked key 2023-01-18 11:41:32 +01:00
packet packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE 2022-12-08 11:23:03 +01:00
phonet
psample
qrtr
rds net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks() 2022-10-26 13:22:26 +02:00
rfkill
rose rose: Fix NULL pointer dereference in rose_send_frame() 2022-11-10 17:57:51 +01:00
rxrpc rxrpc: Fix missing unlock in rxrpc_do_sendmsg() 2023-01-18 11:41:33 +01:00
sched net_sched: reject TCF_EM_SIMPLE case for complex ematch module 2023-01-18 11:41:33 +01:00
sctp sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:03 +01:00
smc net/smc: Remove redundant refcount increase 2022-09-15 12:04:50 +02:00
strparser
sunrpc SUNRPC: Fix missing release socket in rpc_sockname() 2023-01-18 11:41:10 +01:00
switchdev
tipc tipc: Fix potential OOB in tipc_link_proto_rcv() 2022-12-14 11:30:47 +01:00
tls net/tls: Fix race in TLS device down flow 2022-07-29 17:14:12 +02:00
unix af_unix: Get user_ns from in_skb in unix_diag_get_exact(). 2022-12-14 11:30:44 +01:00
vmw_vsock net: vmw_vsock: vmci: Check memcpy_from_msg() 2023-01-18 11:41:13 +01:00
wimax
wireless wifi: cfg80211: Fix not unregister reg_pdev when load_builtin_regdb_keys() fails 2023-01-18 11:41:08 +01:00
x25 net/x25: Fix skb leak in x25_lapb_receive_frame() 2022-11-25 17:42:16 +01:00
xdp
xfrm xfrm: Update ipcomp_scratches with NULL when freed 2022-10-26 13:22:49 +02:00
compat.c
Kconfig
Makefile
socket.c net: Fix a data-race around sysctl_somaxconn. 2022-09-05 10:27:42 +02:00
sysctl_net.c