🇰🇷 한글 설명
Linux 커널의 usb gadget f_tcm 드라이버에서 LUN 제거 과정 중 포트 카운트가 조기에 감소하여 발생하는 레이스 컨디션 취약점입니다. 이로 인해 활성 세션이 남아있는 상태에서 세션 데이터가 해제되어 시스템 오류(BUG/Oops)나 메모리 손상이 발생할 수 있습니다.
💡 쉬운 설명
USB 장치를 연결하거나 해제하는 과정에서 데이터가 아직 처리 중인데 연결 정보가 먼저 삭제되어 컴퓨터가 멈추거나 오류가 발생하는 문제입니다. 장치가 꺼지는 타이밍이 꼬여서 발생하는 소프트웨어적 충돌입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_tcm: keep port count until LUN teardown completes
tcm_usbg_drop_nexus() permits session removal once tpg_port_count
reaches zero. However, usbg_port_unlink() currently decrements that
count from the fabric_pre_unlink() callback, before core_dev_del_lun()
waits for active se_lun references to drain.
If removal of the last LUN races a nexus removal, the latter can observe
a zero port count and call target_remove_session(). This frees
sess_cmd_map while an in-flight struct usbg_cmd, including its work item,
can still be accessed.
Overlapping the last-LUN unlink with nexus removal reproduces this
lifetime violation as a DEBUG_OBJECTS "free active" warning for
usbg_cmd_work, followed by a target-core BUG/Oops.
The generic target-core unlink path has no callback after
core_dev_del_lun() completes. Add an optional fabric_post_unlink()
callback and use it for the f_tcm port count. The count now remains
nonzero until core_dev_del_lun() has finished draining active LUN
references, preventing nexus removal from freeing the session during
command completion.
📍 영향받는 시스템
Linux kernel (usb gadget f_tcm driver components)
⚔️ 공격 벡터
특수하게 조작된 USB 장치를 연결/해제하여 커널 내 레이스 컨디션을 유도하는 방식
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 fabric_post_unlink 콜백이 적용된 수정본을 사용하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인하십시오.