🇰🇷 한글 설명
Linux 커널의 davinci SPI 컨트롤러에서 자원 해제 순서 불일치로 인한 Use-After-Free 취약점이 발견되었습니다. 인터럽트 핸들러가 해제되기 전에 컨트롤러 메모리가 먼저 해제되어, 지연된 인터럽트가 이미 해제된 메모리에 접근할 수 있는 문제가 있습니다.
💡 쉬운 설명
컴퓨터 부품을 정리하는 순서가 잘못되어, 이미 치워버린 물건을 다시 사용하려고 시도하다가 시스템이 충돌할 수 있는 문제입니다. 이로 인해 시스템이 멈추거나 예상치 못한 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
spi: davinci: switch to managed controller allocation
The controller is allocated with the non-managed spi_alloc_host() while
the interrupt is registered with devm_request_threaded_irq(). During
removal, spi_bitbang_stop() only unregisters the controller; the
subsequent spi_controller_put() then frees the controller together with
its embedded davinci_spi devdata, which is the IRQ handler's dev_id.
The devm_request_threaded_irq() release action (free_irq()), which
drains the handler, does not run until after .remove() returns. A late
or latched interrupt can therefore reach davinci_spi_irq() and
dereference already-freed memory.
Switch to devm_spi_alloc_host() so that the devres LIFO order releases
the controller only after free_irq() has drained the handler, and drop
the now-redundant spi_controller_put() from .remove(). The probe error
path is simplified to direct returns.
The clock is acquired with devm_clk_get_enabled(), which is registered
after the IRQ and thus released before it by the devres LIFO order.
Drain the interrupt explicitly with devm_free_irq() before disabling the
controller so that a late interrupt cannot access the registers of a
clock-gated controller.
This issue was found by an in-house static analysis tool.
📍 영향받는 시스템
Linux kernel (davinci SPI driver 사용 시스템)
⚔️ 공격 벡터
하드웨어 인터럽트 발생을 통한 메모리 참조 오류 유도 (로컬/물리적 접근 필요 가능성 높음)
🛡️ 대응 방법
Linux 커널을 최신 패치가 적용된 버전으로 업데이트하여 devm_spi_alloc_host()를 사용하도록 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.