🇰🇷 한글 설명
Linux 커널의 usb gadget f_fs 구성 요소에서 DMA fence 객체의 참조 횟수가 적절히 해제되지 않아 메모리가 누수되는 취약점입니다. ffs_dmabuf_transfer() 함수에서 생성된 객체의 첫 번째 참조가 해제되지 않아 시스템 메모리가 점진적으로 고갈될 수 있습니다.
💡 쉬운 설명
USB 연결 기능을 사용하는 과정에서 컴퓨터의 메모리가 제대로 비워지지 않고 계속 쌓이는 버그가 발견되었습니다. 이 문제가 지속되면 시스템의 메모리가 부족해져 컴퓨터가 느려지거나 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_fs: Fix DMA fence leak
In ffs_dmabuf_transfer(), a ffs_dma_fence object is kmalloc'd, with the
underlying dma_fence later initialized by dma_fence_init(), which sets
its kref counter to 1. Then, dma_resv_add_fence() gets a second
reference, and a pointer to the ffs_dma_fence is passed as the
usb_request's "context" field.
The dma-resv mechanism will manage the second reference, but the first
reference is never properly released; the ffs_dmabuf_cleanup() function
decreases the reference count, but only to balance with the reference
grab in ffs_dmabuf_signal_done().
The code will then slowly leak memory as more ffs_dma_fence objects are
created without being ever freed.
Address this issue by transferring ownership of the fence to the DMA
reservation object, by calling dma_fence_put() right after
dma_resv_add_fence(). The ffs_dma_fence then gets properly discarded
after being signalled.
📍 영향받는 시스템
Linux kernel (usb gadget f_fs module 사용 시스템)
⚔️ 공격 벡터
로컬 공격자가 USB gadget 기능을 반복적으로 사용하여 메모리 고갈 유도
🛡️ 대응 방법
커널 패치를 적용하여 dma_resv_add_fence() 호출 직후 dma_fence_put()을 호출하도록 수정
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인