# CVE-2021-47038: Bluetooth: avoid deadlock between hci\_dev-\>lock and socket lock

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 4, 2026-11-28)
- **CWE:** CWE-667
- **Published:** 2024-02-28T08:13:45.310Z
- **Modified:** 2026-06-17T04:16:16.487Z

## Who should check

- Anyone running Linux \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 7cc0ba67883c6c8d3bddb283f56c167fc837a555; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< fee71f480bc1dec5f6ae3b0b185ff12a62bceabc; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 332e69eb3bd90370f2d9f2c2ca7974ff523dea17; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 17486960d79b900c45e0bb8fbcac0262848582ba
- Anyone running Linux 5.7

## 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---

## Affected and fixed versions

- Linux: \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 7cc0ba67883c6c8d3bddb283f56c167fc837a555; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< fee71f480bc1dec5f6ae3b0b185ff12a62bceabc; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 332e69eb3bd90370f2d9f2c2ca7974ff523dea17; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 17486960d79b900c45e0bb8fbcac0262848582ba (cvelist)
- Linux: 5.7 (cvelist)

## Mitigation

- Upgrade Linux to 17486960d79b900c45e0bb8fbcac0262848582ba or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47038. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47038.md
Affected: Linux >= eab2404ba798a8efda2a970f44071c3406d94e57, < 7cc0ba67883c6c8d3bddb283f56c167fc837a555; >= eab2404ba798a8efda2a970f44071c3406d94e57, < fee71f480bc1dec5f6ae3b0b185ff12a62bceabc; >= eab2404ba798a8efda2a970f44071c3406d94e57, < 332e69eb3bd90370f2d9f2c2ca7974ff523dea17; >= eab2404ba798a8efda2a970…
Fixed in: Linux 7cc0ba67883c6c8d3bddb283f56c167fc837a555, Linux 332e69eb3bd90370f2d9f2c2ca7974ff523dea17, Linux 17486960d79b900c45e0bb8fbcac0262848582ba

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47038 being exploited?

There is no confirmed exploitation: CVE-2021-47038 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.18% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2021-47038?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2021-47038?

Linux \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 7cc0ba67883c6c8d3bddb283f56c167fc837a555; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< fee71f480bc1dec5f6ae3b0b185ff12a62bceabc; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 332e69eb3bd90370f2d9f2c2ca7974ff523dea17; \>= eab2404ba798a8efda2a970f44071c3406d94e57, \< 17486960d79b900c45e0bb8fbcac0262848582ba; Linux 5.7.

### Is there a fix for CVE-2021-47038?

Yes. Fixed in Linux 7cc0ba67883c6c8d3bddb283f56c167fc837a555, Linux 332e69eb3bd90370f2d9f2c2ca7974ff523dea17, Linux 17486960d79b900c45e0bb8fbcac0262848582ba. Upgrade Linux to 17486960d79b900c45e0bb8fbcac0262848582ba or later.

### How do I check if I'm affected by CVE-2021-47038?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/7cc0ba67883c6c8d3bddb283f56c167fc837a555>
- patch: <https://git.kernel.org/stable/c/fee71f480bc1dec5f6ae3b0b185ff12a62bceabc>
- patch: <https://git.kernel.org/stable/c/332e69eb3bd90370f2d9f2c2ca7974ff523dea17>
- patch: <https://git.kernel.org/stable/c/17486960d79b900c45e0bb8fbcac0262848582ba>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47038>

HTML: <https://flawdb.com/CVE-2021-47038> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47038>
