🇰🇷 한글 설명
Linux 커널의 fsl-usb 드라이버에서 장치 제거 시 지연된 작업(delayed work)이 실행되는 동안 메모리가 해제되는 Use-After-Free 취약점이 발견되었습니다. fsl_otg_remove() 함수가 호출될 때 실행 중인 otg_event 작업이 완료되기 전에 메모리를 해제하여 레이스 컨디션이 발생합니다.
💡 쉬운 설명
USB 장치를 제거하는 순간, 컴퓨터가 아직 처리 중인 작업이 있는데 메모리에서 해당 정보를 먼저 지워버려 오류가 발생하는 문제입니다. 이로 인해 시스템이 불안정해지거나 예기치 않은 동작이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: phy: fsl-usb: Fix use-after-free in delayed work during device removal
The delayed work item otg_event is initialized in fsl_otg_conf() and
scheduled under two conditions:
1. When a host controller binds to the OTG controller.
2. When the USB ID pin state changes (cable insertion/removal).
A race condition occurs when the device is removed via fsl_otg_remove():
the fsl_otg instance may be freed while the delayed work is still pending
or executing. This leads to use-after-free when the work function
fsl_otg_event() accesses the already freed memory.
The problematic scenario:
(detach thread) | (delayed work)
fsl_otg_remove() |
kfree(fsl_otg_dev) //FREE| fsl_otg_event()
| og = container_of(...) //USE
| og-> //USE
Fix this by calling disable_delayed_work_sync() in fsl_otg_remove()
before deallocating the fsl_otg structure. This ensures the delayed work
is properly canceled and completes execution prior to memory deallocation.
This bug was identified through static analysis.
📍 영향받는 시스템
Linux kernel (fsl-usb driver 포함 버전)
⚔️ 공격 벡터
로컬 공격자가 특정 USB 장치를 빈번하게 연결하거나 제거하여 레이스 컨디션을 유도함으로써 발생 가능
🛡️ 대응 방법
fsl_otg_remove() 함수 내에서 메모리 해제 전 disable_delayed_work_sync()를 호출하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전인지 배포판 보안 공지를 통해 확인