Lihong Kou
29e1dfcd51
Bluetooth: add a mutex lock to avoid UAF in do_enale_set
[ Upstream commit f9c70bdc279b191da8d60777c627702c06e4a37d ]
In the case we set or free the global value listen_chan in
different threads, we can encounter the UAF problems because
the method is not protected by any lock, add one to avoid
this bug.
BUG: KASAN: use-after-free in l2cap_chan_close+0x48/0x990
net/bluetooth/l2cap_core.c:730
Read of size 8 at addr ffff888096950000 by task kworker/1:102/2868
CPU: 1 PID: 2868 Comm: kworker/1:102 Not tainted 5.5.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine,
BIOS Google 01/01/2011
Workqueue: events do_enable_set
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fb/0x318 lib/dump_stack.c:118
print_address_description+0x74/0x5c0 mm/kasan/report.c:374
__kasan_report+0x149/0x1c0 mm/kasan/report.c:506
kasan_report+0x26/0x50 mm/kasan/common.c:641
__asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
l2cap_chan_close+0x48/0x990 net/bluetooth/l2cap_core.c:730
do_enable_set+0x660/0x900 net/bluetooth/6lowpan.c:1074
process_one_work+0x7f5/0x10f0 kernel/workqueue.c:2264
worker_thread+0xbbc/0x1630 kernel/workqueue.c:2410
kthread+0x332/0x350 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Allocated by task 2870:
save_stack mm/kasan/common.c:72 [inline]
set_track mm/kasan/common.c:80 [inline]
__kasan_kmalloc+0x118/0x1c0 mm/kasan/common.c:515
kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
kmem_cache_alloc_trace+0x221/0x2f0 mm/slab.c:3551
kmalloc include/linux/slab.h:555 [inline]
kzalloc include/linux/slab.h:669 [inline]
l2cap_chan_create+0x50/0x320 net/bluetooth/l2cap_core.c:446
chan_create net/bluetooth/6lowpan.c:640 [inline]
bt_6lowpan_listen net/bluetooth/6lowpan.c:959 [inline]
do_enable_set+0x6a4/0x900 net/bluetooth/6lowpan.c:1078
process_one_work+0x7f5/0x10f0 kernel/workqueue.c:2264
worker_thread+0xbbc/0x1630 kernel/workqueue.c:2410
kthread+0x332/0x350 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Freed by task 2870:
save_stack mm/kasan/common.c:72 [inline]
set_track mm/kasan/common.c:80 [inline]
kasan_set_free_info mm/kasan/common.c:337 [inline]
__kasan_slab_free+0x12e/0x1e0 mm/kasan/common.c:476
kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
__cache_free mm/slab.c:3426 [inline]
kfree+0x10d/0x220 mm/slab.c:3757
l2cap_chan_destroy net/bluetooth/l2cap_core.c:484 [inline]
kref_put include/linux/kref.h:65 [inline]
l2cap_chan_put+0x170/0x190 net/bluetooth/l2cap_core.c:498
do_enable_set+0x66c/0x900 net/bluetooth/6lowpan.c:1075
process_one_work+0x7f5/0x10f0 kernel/workqueue.c:2264
worker_thread+0xbbc/0x1630 kernel/workqueue.c:2410
kthread+0x332/0x350 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
The buggy address belongs to the object at ffff888096950000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes inside of
2048-byte region [ffff888096950000, ffff888096950800)
The buggy address belongs to the page:
page:ffffea00025a5400 refcount:1 mapcount:0 mapping:ffff8880aa400e00 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00027d1548 ffffea0002397808 ffff8880aa400e00
raw: 0000000000000000 ffff888096950000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88809694ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809694ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888096950000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888096950080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888096950100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Reported-by: syzbot+96414aa0033c363d8458@syzkaller.appspotmail.com
Signed-off-by: Lihong Kou <koulihong@huawei.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
|
2020-08-19 08:14:50 +02:00 |
| .. |
|
6lowpan
|
6lowpan: Off by one handling ->nexthdr
|
2020-01-27 14:50:41 +01:00 |
|
9p
|
net/9p: validate fds in p9_fd_open
|
2020-08-11 15:32:32 +02:00 |
|
802
|
|
|
|
8021q
|
vlan: vlan_changelink() should propagate errors
|
2020-01-12 12:17:28 +01:00 |
|
appletalk
|
appletalk: Set error code if register_snap_client failed
|
2019-12-13 08:52:59 +01:00 |
|
atm
|
net: use skb_queue_empty_lockless() in poll() handlers
|
2019-11-10 11:27:48 +01:00 |
|
ax25
|
AX.25: Prevent integer overflows in connect and sendmsg
|
2020-07-31 18:37:48 +02:00 |
|
batman-adv
|
batman-adv: Revert "disable ethtool link speed detection when auto negotiation off"
|
2020-06-22 09:05:12 +02:00 |
|
bluetooth
|
Bluetooth: add a mutex lock to avoid UAF in do_enale_set
|
2020-08-19 08:14:50 +02:00 |
|
bpf
|
bpf/test_run: support cgroup local storage
|
2018-08-03 00:47:32 +02:00 |
|
bpfilter
|
signal/bpfilter: Fix bpfilter_kernl to use send_sig not force_sig
|
2020-01-27 14:50:51 +01:00 |
|
bridge
|
net: bridge: enfore alignment for ethernet address
|
2020-06-30 23:17:03 -04:00 |
|
caif
|
net: use skb_queue_empty_lockless() in poll() handlers
|
2019-11-10 11:27:48 +01:00 |
|
can
|
can: gw: Fix error path of cgw_module_init
|
2019-08-29 08:28:30 +02:00 |
|
ceph
|
libceph: don't omit recovery_deletes in target_copy()
|
2020-07-22 09:32:13 +02:00 |
|
core
|
rtnetlink: Fix memory(net_device) leak when ->newlink fails
|
2020-07-31 18:37:49 +02:00 |
|
dcb
|
net: dcb: Add priority-to-DSCP map getters
|
2018-07-27 13:17:50 -07:00 |
|
dccp
|
net: ipv6: add net argument to ip6_dst_lookup_flow
|
2020-04-29 16:31:16 +02:00 |
|
decnet
|
net: add bool confirm_neigh parameter for dst_ops.update_pmtu
|
2020-01-04 19:13:37 +01:00 |
|
dns_resolver
|
KEYS: Don't write out to userspace while holding key semaphore
|
2020-04-23 10:30:24 +02:00 |
|
dsa
|
net: dsa: mt7530: fix roaming from DSA user ports
|
2020-06-03 08:19:03 +02:00 |
|
ethernet
|
net: add annotations on hh->hh_len lockless accesses
|
2020-01-09 10:19:09 +01:00 |
|
hsr
|
hsr: check protocol version in hsr_newlink()
|
2020-04-21 09:03:03 +02:00 |
|
ieee802154
|
nl802154: add missing attribute validation for dev_type
|
2020-03-18 07:14:15 +01:00 |
|
ife
|
|
|
|
ipv4
|
net: gre: recompute gre csum for sctp over gre tunnels
|
2020-08-11 15:32:34 +02:00 |
|
ipv6
|
ipv6: fix memory leaks on IPV6_ADDRFORM path
|
2020-08-11 15:32:34 +02:00 |
|
iucv
|
net/af_iucv: always register net_device notifier
|
2020-01-27 14:50:56 +01:00 |
|
kcm
|
kcm: switch order of device registration to fix a crash
|
2019-04-17 08:38:40 +02:00 |
|
key
|
af_key: fix leaks in key_pol_get_resp and dump_sp.
|
2019-07-26 09:14:01 +02:00 |
|
l2tp
|
l2tp: remove skb_dst_set() from l2tp_xmit_skb()
|
2020-07-22 09:31:59 +02:00 |
|
l3mdev
|
|
|
|
lapb
|
lapb: fixed leak of control-blocks.
|
2019-06-22 08:15:13 +02:00 |
|
llc
|
llc: make sure applications use ARPHRD_ETHER
|
2020-07-22 09:31:59 +02:00 |
|
mac80211
|
mac80211: mesh: Free pending skb when destroying a mpath
|
2020-08-05 10:06:04 +02:00 |
|
mac802154
|
net: mac802154: tx: expand tailroom if necessary
|
2018-08-06 11:21:37 +02:00 |
|
mpls
|
net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup
|
2020-04-29 16:31:17 +02:00 |
|
ncsi
|
net/ncsi: Fixup .dumpit message flags and ID check in Netlink handler
|
2018-08-22 21:39:08 -07:00 |
|
netfilter
|
ipvs: fix the connection sync failed in some cases
|
2020-07-29 10:16:50 +02:00 |
|
netlabel
|
netlabel: cope with NULL catmap
|
2020-05-20 08:18:35 +02:00 |
|
netlink
|
genetlink: remove genl_bind
|
2020-07-22 09:31:58 +02:00 |
|
netrom
|
net: netrom: Fix potential nr_neigh refcnt leak in nr_add_node
|
2020-04-29 16:31:21 +02:00 |
|
nfc
|
nfc: add missing attribute validation for vendor subcommand
|
2020-03-18 07:14:17 +01:00 |
|
nsh
|
nsh: set mac len based on inner packet
|
2018-07-12 16:55:29 -07:00 |
|
openvswitch
|
openvswitch: Prevent kernel-infoleak in ovs_ct_put_key()
|
2020-08-11 15:32:35 +02:00 |
|
packet
|
net/packet: tpacket_rcv: avoid a producer race condition
|
2020-04-02 15:28:11 +02:00 |
|
phonet
|
net: use skb_queue_empty_lockless() in poll() handlers
|
2019-11-10 11:27:48 +01:00 |
|
psample
|
net: psample: fix skb_over_panic
|
2019-12-05 09:21:30 +01:00 |
|
qrtr
|
qrtr: orphan socket in qrtr_release()
|
2020-07-31 18:37:48 +02:00 |
|
rds
|
rds: Prevent kernel-infoleak in rds_notify_queue_get()
|
2020-08-05 10:06:01 +02:00 |
|
rfkill
|
rfkill: Fix incorrect check to avoid NULL pointer dereference
|
2020-01-12 12:17:17 +01:00 |
|
rose
|
net/rose: fix unbound loop in rose_loopback_timer()
|
2019-05-02 09:59:00 +02:00 |
|
rxrpc
|
rxrpc: Fix race between recvmsg and sendmsg on immediate call failure
|
2020-08-11 15:32:35 +02:00 |
|
sched
|
sched: consistently handle layer3 header accesses in the presence of VLANs
|
2020-07-22 09:32:00 +02:00 |
|
sctp
|
sctp: implement memory accounting on tx path
|
2020-08-05 10:06:00 +02:00 |
|
smc
|
net/smc: cancel event worker during device removal
|
2020-03-18 07:14:25 +01:00 |
|
strparser
|
net: strparser: partially revert "strparser: Call skb_unclone conditionally"
|
2019-05-16 19:41:27 +02:00 |
|
sunrpc
|
SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
|
2020-06-30 23:17:18 -04:00 |
|
switchdev
|
|
|
|
tipc
|
tipc: clean up skb list lock handling on send path
|
2020-07-29 10:16:47 +02:00 |
|
tls
|
net/tls: Fix to avoid gettig invalid tls record
|
2020-03-05 16:42:17 +01:00 |
|
unix
|
af_unix: add compat_ioctl support
|
2020-01-17 19:47:07 +01:00 |
|
vmw_vsock
|
vsock: fix timeout in vsock_accept()
|
2020-06-10 21:34:59 +02:00 |
|
wimax
|
wimax: remove blank lines at EOF
|
2018-07-24 14:10:42 -07:00 |
|
wireless
|
cfg80211: check vendor command doit pointer before use
|
2020-08-11 15:32:33 +02:00 |
|
x25
|
net/x25: Fix null-ptr-deref in x25_disconnect
|
2020-08-05 10:06:02 +02:00 |
|
xdp
|
xdp: Fix xsk_generic_xmit errno
|
2020-06-25 15:33:05 +02:00 |
|
xfrm
|
xfrm: Fix double ESP trailer insertion in IPsec crypto offload.
|
2020-06-30 23:17:10 -04:00 |
|
compat.c
|
sock: Make sock->sk_stamp thread-safe
|
2019-01-09 17:38:33 +01:00 |
|
Kconfig
|
net: remove blank lines at end of file
|
2018-07-24 14:10:43 -07:00 |
|
Makefile
|
bpfilter: check compiler capability in Kconfig
|
2018-06-28 13:36:39 +09:00 |
|
socket.c
|
compat_ioctl: handle SIOCOUTQNSD
|
2020-01-17 19:47:07 +01:00 |
|
sysctl_net.c
|
|
|