🇰🇷 한글 설명
Linux 커널의 USB Type-C UCSI CCG 드라이버에서 장치 제거 시 Use-After-Free 취약점이 발견되었습니다. 장치를 제거하는 과정에서 인터럽트 핸들러가 실행되기 전에 메모리가 먼저 해제되어, 이미 실행 중인 핸들러가 해제된 메모리에 접근할 수 있는 문제입니다.
💡 쉬운 설명
컴퓨터에서 USB 장치를 뽑을 때, 시스템이 장치가 사라졌음을 인지하기도 전에 관련 메모리를 먼저 지워버리는 오류입니다. 이로 인해 시스템이 잘못된 메모리를 참조하게 되어 프로그램이 강제 종료되거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: typec: ucsi: ccg: Fix use-after-free of ucsi on remove
The threaded IRQ handler ccg_irq_handler() calls ucsi_notify_common(),
which on a connector-change event calls ucsi_connector_change() and
schedules connector work. In ucsi_ccg_remove(), ucsi_destroy() frees
uc->ucsi (kfree) before free_irq() is called, so a handler invocation
already in flight may access the freed object after ucsi_destroy().
CPU 0 (remove) | CPU 1 (threaded IRQ)
ucsi_destroy(uc->ucsi) | ccg_irq_handler()
kfree(ucsi) // FREE | ucsi_notify_common(uc->ucsi) // USE
Move free_irq() before ucsi_destroy() in the remove path. It is kept
after ucsi_unregister(): ucsi_unregister() cancels connector work whose
handler issues GET_CONNECTOR_STATUS through ucsi_send_command_common(),
which waits for a completion that is signalled from the IRQ handler, so
the IRQ must stay active until that work has been cancelled.
The probe error path already orders free_irq() before ucsi_destroy().
This bug was found by static analysis.
📍 영향받는 시스템
Linux Kernel (USB Type-C UCSI CCG driver 포함 버전)
⚔️ 공격 벡터
물리적 또는 소프트웨어적인 USB Type-C 장치 연결/해제 반복을 통한 트리거
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 ucsi_destroy() 호출 전 free_irq()가 실행되도록 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이상인지 확인합니다.