Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2021-47038— Bluetooth: avoid deadlock between hci_dev->lock and socket lock

Quick assessment

Affected
Linux Linux
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于 hci_dev->lock 和 socket lock 之间的依赖关系,这可能导致死锁。

AI Predicted 5.5 Difficulty: Moderate EPSS 0.18% · P7

Possible ATT&CK Techniques 1 AI

T1190 · Exploit Public-Facing Application

Affected Version Matrix 10

VendorProduct Version RangeStatus
Linux Linux eab2404ba798a8efda2a970f44071c3406d94e57< 7cc0ba67883c6c8d3bddb283f56c167fc837a555 affected
eab2404ba798a8efda2a970f44071c3406d94e57< fee71f480bc1dec5f6ae3b0b185ff12a62bceabc affected
eab2404ba798a8efda2a970f44071c3406d94e57< 332e69eb3bd90370f2d9f2c2ca7974ff523dea17 affected
eab2404ba798a8efda2a970f44071c3406d94e57< 17486960d79b900c45e0bb8fbcac0262848582ba affected
5.7 affected
< 5.7 unaffected
5.10.37≤ 5.10.* unaffected
5.11.21≤ 5.11.* unaffected
… +2 more rows
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2021-47038

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
Bluetooth: avoid deadlock between hci_dev->lock and socket lock
Source: CVE Program / CVE List V5
Vulnerability Description
In the Linux kernel, the following vulnerability has been resolved: Bluetooth: avoid deadlock between hci_dev->lock and socket lock Commit eab2404ba798 ("Bluetooth: Add BT_PHY socket option") added a dependency between socket lock and hci_dev->lock that could lead to deadlock. It turns out that hci_conn_get_phy() is not in any way relying on hdev being immutable during the runtime of this function, neither does it even look at any of the members of hdev, and as such there is no need to hold that lock. This fixes the lockdep splat below: ====================================================== WARNING: possible circular locking dependency detected 5.12.0-rc1-00026-g73d464503354 #10 Not tainted ------------------------------------------------------ bluetoothd/1118 is trying to acquire lock: ffff8f078383c078 (&hdev->lock){+.+.}-{3:3}, at: hci_conn_get_phy+0x1c/0x150 [bluetooth] but task is already holding lock: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}: lock_sock_nested+0x72/0xa0 l2cap_sock_ready_cb+0x18/0x70 [bluetooth] l2cap_config_rsp+0x27a/0x520 [bluetooth] l2cap_sig_channel+0x658/0x1330 [bluetooth] l2cap_recv_frame+0x1ba/0x310 [bluetooth] hci_rx_work+0x1cc/0x640 [bluetooth] process_one_work+0x244/0x5f0 worker_thread+0x3c/0x380 kthread+0x13e/0x160 ret_from_fork+0x22/0x30 -> #2 (&chan->lock#2/1){+.+.}-{3:3}: __mutex_lock+0xa3/0xa10 l2cap_chan_connect+0x33a/0x940 [bluetooth] l2cap_sock_connect+0x141/0x2a0 [bluetooth] __sys_connect+0x9b/0xc0 __x64_sys_connect+0x16/0x20 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&conn->chan_lock){+.+.}-{3:3}: __mutex_lock+0xa3/0xa10 l2cap_chan_connect+0x322/0x940 [bluetooth] l2cap_sock_connect+0x141/0x2a0 [bluetooth] __sys_connect+0x9b/0xc0 __x64_sys_connect+0x16/0x20 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (&hdev->lock){+.+.}-{3:3}: __lock_acquire+0x147a/0x1a50 lock_acquire+0x277/0x3d0 __mutex_lock+0xa3/0xa10 hci_conn_get_phy+0x1c/0x150 [bluetooth] l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth] __sys_getsockopt+0xcc/0x200 __x64_sys_getsockopt+0x20/0x30 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: &hdev->lock --> &chan->lock#2/1 --> sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP); lock(&chan->lock#2/1); lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP); lock(&hdev->lock); *** DEADLOCK *** 1 lock held by bluetoothd/1118: #0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 [bluetooth] stack backtrace: CPU: 3 PID: 1118 Comm: bluetoothd Not tainted 5.12.0-rc1-00026-g73d464503354 #10 Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017 Call Trace: dump_stack+0x7f/0xa1 check_noncircular+0x105/0x120 ? __lock_acquire+0x147a/0x1a50 __lock_acquire+0x147a/0x1a50 lock_acquire+0x277/0x3d0 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] ? __lock_acquire+0x2e1/0x1a50 ? lock_is_held_type+0xb4/0x120 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] __mutex_lock+0xa3/0xa10 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] ? lock_acquire+0x277/0x3d0 ? mark_held_locks+0x49/0x70 ? mark_held_locks+0x49/0x70 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] hci_conn_get_phy+0x ---truncated---
Source: CVE Program / CVE List V5
CVSS Information
N/A
Source: CVE Program / CVE List V5
Vulnerability Type
N/A
Source: CVE Program / CVE List V5
Vulnerability Title
Linux kernel 安全漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于 hci_dev->lock 和 socket lock 之间的依赖关系,这可能导致死锁。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
Linux Linux eab2404ba798a8efda2a970f44071c3406d94e57 ~ 7cc0ba67883c6c8d3bddb283f56c167fc837a555 -
Linux Linux 5.7 -

II. Public POCs for CVE-2021-47038

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2021-47038

请登录查看更多情报信息。

Other References for CVE-2021-47038 (4)

Same Patch Batch · Linux · 2024-02-28 · 86 CVEs total

CVE-2021-47036 9.8 CRITICAL udp: skip L4 aggregation for UDP tunnel packets
CVE-2021-46999 9.8 CRITICAL sctp: do asoc update earlier in sctp_sf_do_dupcook_a
CVE-2021-47013 9.8 CRITICAL net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
CVE-2021-47035 8.8 HIGH iommu/vt-d: Remove WO permissions on second-level paging entries
CVE-2021-47017 8.8 HIGH ath10k: Fix a use after free in ath10k_htc_send_bundle
CVE-2021-47049 8.4 HIGH Drivers: hv: vmbus: Use after free in __vmbus_open()
CVE-2021-46984 7.8 HIGH kyber: fix out of bounds access when preempted
CVE-2021-46993 7.8 HIGH sched: Fix out-of-bound access in uclamp
CVE-2021-46977 7.8 HIGH KVM: VMX: Disable preemption when probing user return MSRs
CVE-2021-47014 7.8 HIGH net/sched: act_ct: fix wild memory access when clearing fragments
CVE-2021-47040 7.8 HIGH io_uring: fix overflows checks in provide buffers
CVE-2020-36787 7.8 HIGH media: aspeed: fix clock handling logic
CVE-2020-36785 7.8 HIGH media: atomisp: Fix use after free in atomisp_alloc_css_stat_bufs()
CVE-2021-47011 7.8 HIGH mm: memcontrol: slab: fix obtain a reference to a freeing memcg
CVE-2021-47012 7.8 HIGH RDMA/siw: Fix a use after free in siw_alloc_mr
CVE-2021-46992 7.8 HIGH netfilter: nftables: avoid overflows in nft_hash_buckets()
CVE-2021-47048 7.8 HIGH spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op
CVE-2021-46998 7.8 HIGH ethernet:enic: Fix a use after free bug in enic_hard_start_xmit
CVE-2021-46983 7.5 HIGH nvmet-rdma: Fix NULL deref when SEND is completed with error
CVE-2021-47041 7.5 HIGH nvmet-tcp: fix incorrect locking in state_change sk callback

Showing top 20 of 86 CVEs. View all on vendor page &rarr; →

IV. Related Vulnerabilities

V. Comments for CVE-2021-47038

No comments yet


Leave a comment