🇰🇷 한글 설명
리눅스 커널의 NFC 서브시스템에서 nfc_unregister_device와 rfkill_fop_write 함수 간의 잠금 순서 역전으로 인한 데드락(Deadlock) 취약점이 발견되었습니다. 이로 인해 시스템이 응답하지 않는 상태에 빠질 수 있습니다.
💡 쉬운 설명
두 개의 작업이 서로 상대방이 가진 열쇠를 기다리며 무한히 대기하는 상황이 발생하여 컴퓨터가 멈출 수 있는 문제입니다. NFC 장치를 해제하는 과정과 무선 통신을 차단하는 과정이 충돌하여 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write
A deadlock can occur between nfc_unregister_device() and rfkill_fop_write()
due to lock ordering inversion between device_lock and rfkill_global_mutex.
The problematic lock order is:
Thread A (rfkill_fop_write):
rfkill_fop_write()
mutex_lock(&rfkill_global_mutex)
rfkill_set_block()
nfc_rfkill_set_block()
nfc_dev_down()
device_lock(&dev->dev) <- waits for device_lock
Thread B (nfc_unregister_device):
nfc_unregister_device()
device_lock(&dev->dev)
rfkill_unregister()
mutex_lock(&rfkill_global_mutex) <- waits for rfkill_global_mutex
This creates a classic ABBA deadlock scenario.
Fix this by moving rfkill_unregister() and rfkill_destroy() outside the
device_lock critical section. Store the rfkill pointer in a local variable
before releasing the lock, then call rfkill_unregister() after releasing
device_lock.
This change is safe because rfkill_fop_write() holds rfkill_global_mutex
while calling the rfkill callbacks, and rfkill_unregister() also acquires
rfkill_global_mutex before cleanup. Therefore, rfkill_unregister() will
wait for any ongoing callback to complete before proceeding, and
device_del() is only called after rfkill_unregister() returns, preventing
any use-after-free.
The similar lock ordering in nfc_register_device() (device_lock ->
rfkill_global_mutex via rfkill_register) is safe because during
registration the device is not yet in rfkill_list, so no concurrent
rfkill operations can occur on this device.
📍 영향받는 시스템
Linux Kernel (NFC 및 rfkill 관련 모듈 사용 시스템)
⚔️ 공격 벡터
로컬 사용자가 NFC 장치 등록/해제 및 rfkill 설정을 동시에 수행하여 시스템 교착 상태 유도
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인하십시오.