🇰🇷 한글 설명
Linux 커널의 Bluetooth hci_core에서 메모리 압박이 발생할 경우 skb_clone() 함수가 실패하여 req_skb가 NULL이 되는 취약점이 있습니다. 이로 인해 블루투스 명령 완료 콜백이 호출되지 않아 시스템이 타임아웃(-ETIMEDOUT)을 발생시키며 블루투스 활성화에 실패하게 됩니다.
💡 쉬운 설명
메모리가 부족할 때 블루투스 명령을 처리하는 과정에서 데이터 복사에 실패하여 블루투스가 제대로 켜지지 않는 문제입니다. 명령이 완료되었다는 신호를 받아도 이를 처리할 연결 고리가 끊어져 버리는 현상입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_core: use skb_get() instead of skb_clone() for req_skb
BT enable fails intermittently with -ETIMEDOUT (-110). The kernel log
shows the HCI Read Local Version command was sent and the firmware
replied with status 0x00 (logged by hci_req_cmd_complete() BT_DBG),
but the waiter in __hci_cmd_sync_sk() never woke up and timed out
after 10 s:
bluetooth hci0: Opcode 0xfc00 // __hci_cmd_sync_sk
bluetooth hci0: opcode 0xfc00 plen 1 // hci_cmd_sync_add
bluetooth hci0: skb len 4 // hci_cmd_sync_alloc
bluetooth hci0: length 1 // hci_req_sync_run
Bluetooth: hci0 cmd_cnt 1 cmd queued 1 // hci_cmd_work
Bluetooth: hci0 type 1 len 4 // hci_send_frame
Bluetooth: opcode 0xfc00 status 0x00 // hci_req_cmd_complete
<-- req_skb NULL: req_complete_skb not set,
hci_cmd_sync_complete() never called,
req_status stays HCI_REQ_PEND -->
<-- 10 s later: wait_event_interruptible_timeout expires -->
bluetooth hci0: end: err -110 // __hci_cmd_sync_sk
The root cause is that hci_send_cmd_sync() clones the sent command
into hdev->req_skb so that hci_req_cmd_complete() can locate the
registered completion callback. Under memory pressure this
skb_clone() fails, leaving hdev->req_skb NULL. The firmware reply
is received and processed, but hci_req_cmd_complete() finds NULL
req_skb, so hci_cmd_sync_complete() is never called, req_status
stays HCI_REQ_PEND, and the waiter times out with -ETIMEDOUT.
req_skb is only used to read bt_cb(skb)->hci callbacks and opcode --
it is never modified. Replace skb_clone() with skb_get(), which
simply increments the reference count of hdev->sent_cmd without
allocating new memory and therefore cannot fail.
This issue was first observed as a use-after-free in ttyport_close()
when ttyport_open() failed, which was investigated in an earlier
patch series [1]. That investigation led to the discovery of the
true root cause described above.
[1] https://lore.kernel.org/all/
[email protected]/
📍 영향받는 시스템
Linux Kernel (Bluetooth hci_core 관련 버전)
⚔️ 공격 벡터
메모리 부족 상태를 유도하여 블루투스 서비스 거부(DoS) 유발
🛡️ 대응 방법
skb_clone() 대신 메모리 할당 실패 가능성이 없는 skb_get()을 사용하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인