cve-2021-47038
Vulnerability from cvelistv5
Published
2024-02-28 08:13
Modified
2024-11-04 11:58
Severity ?
EPSS score ?
Summary
Bluetooth: avoid deadlock between hci_dev->lock and socket lock
References
{ "containers": { "adp": [ { "providerMetadata": { "dateUpdated": "2024-08-04T05:24:39.488Z", "orgId": "af854a3a-2127-422b-91ae-364da2661108", "shortName": "CVE" }, "references": [ { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/7cc0ba67883c6c8d3bddb283f56c167fc837a555" }, { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/fee71f480bc1dec5f6ae3b0b185ff12a62bceabc" }, { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/332e69eb3bd90370f2d9f2c2ca7974ff523dea17" }, { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/17486960d79b900c45e0bb8fbcac0262848582ba" } ], "title": "CVE Program Container" }, { "metrics": [ { "other": { "content": { "id": "CVE-2021-47038", "options": [ { "Exploitation": "none" }, { "Automatable": "no" }, { "Technical Impact": "partial" } ], "role": "CISA Coordinator", "timestamp": "2024-09-10T15:57:52.490548Z", "version": "2.0.3" }, "type": "ssvc" } } ], "providerMetadata": { "dateUpdated": "2024-09-11T17:33:20.423Z", "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP" }, "title": "CISA ADP Vulnrichment" } ], "cna": { "affected": [ { "defaultStatus": "unaffected", "product": "Linux", "programFiles": [ "net/bluetooth/hci_conn.c" ], "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "vendor": "Linux", "versions": [ { "lessThan": "7cc0ba67883c", "status": "affected", "version": "eab2404ba798", "versionType": "git" }, { "lessThan": "fee71f480bc1", "status": "affected", "version": "eab2404ba798", "versionType": "git" }, { "lessThan": "332e69eb3bd9", "status": "affected", "version": "eab2404ba798", "versionType": "git" }, { "lessThan": "17486960d79b", "status": "affected", "version": "eab2404ba798", "versionType": "git" } ] }, { "defaultStatus": "affected", "product": "Linux", "programFiles": [ "net/bluetooth/hci_conn.c" ], "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "vendor": "Linux", "versions": [ { "status": "affected", "version": "5.7" }, { "lessThan": "5.7", "status": "unaffected", "version": "0", "versionType": "semver" }, { "lessThanOrEqual": "5.10.*", "status": "unaffected", "version": "5.10.37", "versionType": "semver" }, { "lessThanOrEqual": "5.11.*", "status": "unaffected", "version": "5.11.21", "versionType": "semver" }, { "lessThanOrEqual": "5.12.*", "status": "unaffected", "version": "5.12.4", "versionType": "semver" }, { "lessThanOrEqual": "*", "status": "unaffected", "version": "5.13", "versionType": "original_commit_for_fix" } ] } ], "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nBluetooth: avoid deadlock between hci_dev-\u003elock and socket lock\n\nCommit eab2404ba798 (\"Bluetooth: Add BT_PHY socket option\") added a\ndependency between socket lock and hci_dev-\u003elock that could lead to\ndeadlock.\n\nIt turns out that hci_conn_get_phy() is not in any way relying on hdev\nbeing immutable during the runtime of this function, neither does it even\nlook at any of the members of hdev, and as such there is no need to hold\nthat lock.\n\nThis fixes the lockdep splat below:\n\n ======================================================\n WARNING: possible circular locking dependency detected\n 5.12.0-rc1-00026-g73d464503354 #10 Not tainted\n ------------------------------------------------------\n bluetoothd/1118 is trying to acquire lock:\n ffff8f078383c078 (\u0026hdev-\u003elock){+.+.}-{3:3}, at: hci_conn_get_phy+0x1c/0x150 [bluetooth]\n\n but task is already holding lock:\n ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610\n\n which lock already depends on the new lock.\n\n the existing dependency chain (in reverse order) is:\n\n -\u003e #3 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}:\n lock_sock_nested+0x72/0xa0\n l2cap_sock_ready_cb+0x18/0x70 [bluetooth]\n l2cap_config_rsp+0x27a/0x520 [bluetooth]\n l2cap_sig_channel+0x658/0x1330 [bluetooth]\n l2cap_recv_frame+0x1ba/0x310 [bluetooth]\n hci_rx_work+0x1cc/0x640 [bluetooth]\n process_one_work+0x244/0x5f0\n worker_thread+0x3c/0x380\n kthread+0x13e/0x160\n ret_from_fork+0x22/0x30\n\n -\u003e #2 (\u0026chan-\u003elock#2/1){+.+.}-{3:3}:\n __mutex_lock+0xa3/0xa10\n l2cap_chan_connect+0x33a/0x940 [bluetooth]\n l2cap_sock_connect+0x141/0x2a0 [bluetooth]\n __sys_connect+0x9b/0xc0\n __x64_sys_connect+0x16/0x20\n do_syscall_64+0x33/0x80\n entry_SYSCALL_64_after_hwframe+0x44/0xae\n\n -\u003e #1 (\u0026conn-\u003echan_lock){+.+.}-{3:3}:\n __mutex_lock+0xa3/0xa10\n l2cap_chan_connect+0x322/0x940 [bluetooth]\n l2cap_sock_connect+0x141/0x2a0 [bluetooth]\n __sys_connect+0x9b/0xc0\n __x64_sys_connect+0x16/0x20\n do_syscall_64+0x33/0x80\n entry_SYSCALL_64_after_hwframe+0x44/0xae\n\n -\u003e #0 (\u0026hdev-\u003elock){+.+.}-{3:3}:\n __lock_acquire+0x147a/0x1a50\n lock_acquire+0x277/0x3d0\n __mutex_lock+0xa3/0xa10\n hci_conn_get_phy+0x1c/0x150 [bluetooth]\n l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth]\n __sys_getsockopt+0xcc/0x200\n __x64_sys_getsockopt+0x20/0x30\n do_syscall_64+0x33/0x80\n entry_SYSCALL_64_after_hwframe+0x44/0xae\n\n other info that might help us debug this:\n\n Chain exists of:\n \u0026hdev-\u003elock --\u003e \u0026chan-\u003elock#2/1 --\u003e sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP\n\n Possible unsafe locking scenario:\n\n CPU0 CPU1\n ---- ----\n lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);\n lock(\u0026chan-\u003elock#2/1);\n lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);\n lock(\u0026hdev-\u003elock);\n\n *** DEADLOCK ***\n\n 1 lock held by bluetoothd/1118:\n #0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 [bluetooth]\n\n stack backtrace:\n CPU: 3 PID: 1118 Comm: bluetoothd Not tainted 5.12.0-rc1-00026-g73d464503354 #10\n Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017\n Call Trace:\n dump_stack+0x7f/0xa1\n check_noncircular+0x105/0x120\n ? __lock_acquire+0x147a/0x1a50\n __lock_acquire+0x147a/0x1a50\n lock_acquire+0x277/0x3d0\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\n ? __lock_acquire+0x2e1/0x1a50\n ? lock_is_held_type+0xb4/0x120\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\n __mutex_lock+0xa3/0xa10\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\n ? lock_acquire+0x277/0x3d0\n ? mark_held_locks+0x49/0x70\n ? mark_held_locks+0x49/0x70\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\n hci_conn_get_phy+0x\n---truncated---" } ], "providerMetadata": { "dateUpdated": "2024-11-04T11:58:13.032Z", "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux" }, "references": [ { "url": "https://git.kernel.org/stable/c/7cc0ba67883c6c8d3bddb283f56c167fc837a555" }, { "url": "https://git.kernel.org/stable/c/fee71f480bc1dec5f6ae3b0b185ff12a62bceabc" }, { "url": "https://git.kernel.org/stable/c/332e69eb3bd90370f2d9f2c2ca7974ff523dea17" }, { "url": "https://git.kernel.org/stable/c/17486960d79b900c45e0bb8fbcac0262848582ba" } ], "title": "Bluetooth: avoid deadlock between hci_dev-\u003elock and socket lock", "x_generator": { "engine": "bippy-9e1c9544281a" } } }, "cveMetadata": { "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "assignerShortName": "Linux", "cveId": "CVE-2021-47038", "datePublished": "2024-02-28T08:13:45.310Z", "dateReserved": "2024-02-27T18:42:55.965Z", "dateUpdated": "2024-11-04T11:58:13.032Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1", "meta": { "nvd": "{\"cve\":{\"id\":\"CVE-2021-47038\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-02-28T09:15:39.893\",\"lastModified\":\"2024-02-28T14:06:45.783\",\"vulnStatus\":\"Awaiting Analysis\",\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nBluetooth: avoid deadlock between hci_dev-\u003elock and socket lock\\n\\nCommit eab2404ba798 (\\\"Bluetooth: Add BT_PHY socket option\\\") added a\\ndependency between socket lock and hci_dev-\u003elock that could lead to\\ndeadlock.\\n\\nIt turns out that hci_conn_get_phy() is not in any way relying on hdev\\nbeing immutable during the runtime of this function, neither does it even\\nlook at any of the members of hdev, and as such there is no need to hold\\nthat lock.\\n\\nThis fixes the lockdep splat below:\\n\\n ======================================================\\n WARNING: possible circular locking dependency detected\\n 5.12.0-rc1-00026-g73d464503354 #10 Not tainted\\n ------------------------------------------------------\\n bluetoothd/1118 is trying to acquire lock:\\n ffff8f078383c078 (\u0026hdev-\u003elock){+.+.}-{3:3}, at: hci_conn_get_phy+0x1c/0x150 [bluetooth]\\n\\n but task is already holding lock:\\n ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610\\n\\n which lock already depends on the new lock.\\n\\n the existing dependency chain (in reverse order) is:\\n\\n -\u003e #3 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}:\\n lock_sock_nested+0x72/0xa0\\n l2cap_sock_ready_cb+0x18/0x70 [bluetooth]\\n l2cap_config_rsp+0x27a/0x520 [bluetooth]\\n l2cap_sig_channel+0x658/0x1330 [bluetooth]\\n l2cap_recv_frame+0x1ba/0x310 [bluetooth]\\n hci_rx_work+0x1cc/0x640 [bluetooth]\\n process_one_work+0x244/0x5f0\\n worker_thread+0x3c/0x380\\n kthread+0x13e/0x160\\n ret_from_fork+0x22/0x30\\n\\n -\u003e #2 (\u0026chan-\u003elock#2/1){+.+.}-{3:3}:\\n __mutex_lock+0xa3/0xa10\\n l2cap_chan_connect+0x33a/0x940 [bluetooth]\\n l2cap_sock_connect+0x141/0x2a0 [bluetooth]\\n __sys_connect+0x9b/0xc0\\n __x64_sys_connect+0x16/0x20\\n do_syscall_64+0x33/0x80\\n entry_SYSCALL_64_after_hwframe+0x44/0xae\\n\\n -\u003e #1 (\u0026conn-\u003echan_lock){+.+.}-{3:3}:\\n __mutex_lock+0xa3/0xa10\\n l2cap_chan_connect+0x322/0x940 [bluetooth]\\n l2cap_sock_connect+0x141/0x2a0 [bluetooth]\\n __sys_connect+0x9b/0xc0\\n __x64_sys_connect+0x16/0x20\\n do_syscall_64+0x33/0x80\\n entry_SYSCALL_64_after_hwframe+0x44/0xae\\n\\n -\u003e #0 (\u0026hdev-\u003elock){+.+.}-{3:3}:\\n __lock_acquire+0x147a/0x1a50\\n lock_acquire+0x277/0x3d0\\n __mutex_lock+0xa3/0xa10\\n hci_conn_get_phy+0x1c/0x150 [bluetooth]\\n l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth]\\n __sys_getsockopt+0xcc/0x200\\n __x64_sys_getsockopt+0x20/0x30\\n do_syscall_64+0x33/0x80\\n entry_SYSCALL_64_after_hwframe+0x44/0xae\\n\\n other info that might help us debug this:\\n\\n Chain exists of:\\n \u0026hdev-\u003elock --\u003e \u0026chan-\u003elock#2/1 --\u003e sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP\\n\\n Possible unsafe locking scenario:\\n\\n CPU0 CPU1\\n ---- ----\\n lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);\\n lock(\u0026chan-\u003elock#2/1);\\n lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);\\n lock(\u0026hdev-\u003elock);\\n\\n *** DEADLOCK ***\\n\\n 1 lock held by bluetoothd/1118:\\n #0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 [bluetooth]\\n\\n stack backtrace:\\n CPU: 3 PID: 1118 Comm: bluetoothd Not tainted 5.12.0-rc1-00026-g73d464503354 #10\\n Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017\\n Call Trace:\\n dump_stack+0x7f/0xa1\\n check_noncircular+0x105/0x120\\n ? __lock_acquire+0x147a/0x1a50\\n __lock_acquire+0x147a/0x1a50\\n lock_acquire+0x277/0x3d0\\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\\n ? __lock_acquire+0x2e1/0x1a50\\n ? lock_is_held_type+0xb4/0x120\\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\\n __mutex_lock+0xa3/0xa10\\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\\n ? lock_acquire+0x277/0x3d0\\n ? mark_held_locks+0x49/0x70\\n ? mark_held_locks+0x49/0x70\\n ? hci_conn_get_phy+0x1c/0x150 [bluetooth]\\n hci_conn_get_phy+0x\\n---truncated---\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: Bluetooth: evitar interbloqueo entre hci_dev-\u0026gt;lock y socket lock. el commit eab2404ba798 (\\\"Bluetooth: Add BT_PHY socket option\\\") agreg\u00f3 una dependencia entre socket lock y hci_dev-\u0026gt;lock que podr\u00eda provocar a un punto muerto. Resulta que hci_conn_get_phy() no depende de ninguna manera de que hdev sea inmutable durante el tiempo de ejecuci\u00f3n de esta funci\u00f3n, ni siquiera mira a ninguno de los miembros de hdev y, como tal, no es necesario mantener ese bloqueo. Esto soluciona el problema de bloqueo a continuaci\u00f3n: ============================================ =========== ADVERTENCIA: posible dependencia de bloqueo circular detectada 5.12.0-rc1-00026-g73d464503354 #10 No contaminado ------------------- ----------------------------------- bluetoothd/1118 est\u00e1 intentando adquirir el bloqueo: ffff8f078383c078 (\u0026amp;hdev-\u0026gt;lock ){+.+.}-{3:3}, en: hci_conn_get_phy+0x1c/0x150 [bluetooth] pero la tarea ya est\u00e1 bloqueada: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0 }, en: l2cap_sock_getsockopt+0x8b/0x610 cuyo bloqueo ya depende del nuevo bloqueo. la cadena de dependencia existente (en orden inverso) es: -\u0026gt; #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 trabajador_thread+0x3c/0x380 kthread+0 x13e/0x160 ret_from_fork+0x22/0x30 -\u0026gt; #2 (\u0026amp;chan-\u0026gt;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 -\u0026gt; #1 (\u0026amp;conn-\u0026gt;chan_lock){+.+.}-{3:3}: __mutex_lock+0xa3/0xa10 l2cap_chan_connect+0 x322/ 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 -\u0026gt; #0 (\u0026amp;hdev- \u0026gt;bloquear){+.+.}-{ 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 otra informaci\u00f3n que podr\u00eda ayudarnos a depurar esto: Existe cadena de: \u0026amp;hdev-\u0026gt;lock --\u0026gt; \u0026amp;chan-\u0026gt;lock#2/1 --\u0026gt; sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP Posible escenario de bloqueo inseguro: CPU0 CPU1 - --- ---- bloqueo(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP); bloquear(\u0026amp;chan-\u0026gt;bloquear#2/1); bloquear(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP); bloquear(\u0026amp;hdev-\u0026gt;bloquear); *** DEADLOCK *** 1 bloqueo retenido por bluetoothd/1118: #0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, en: l2cap_sock_getsockopt+0x8b/0x610 pila [bluetooth] backtrace: CPU: 3 PID: 1118 Comm: bluetoothd No contaminado 5.12.0-rc1-00026-g73d464503354 #10 Nombre de hardware: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16) 31/05/2017 Seguimiento de llamadas: dump_stack+0x7 f/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 ---truncado---\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/17486960d79b900c45e0bb8fbcac0262848582ba\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/332e69eb3bd90370f2d9f2c2ca7974ff523dea17\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/7cc0ba67883c6c8d3bddb283f56c167fc837a555\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/fee71f480bc1dec5f6ae3b0b185ff12a62bceabc\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}" } }
Loading...
Loading...
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.