🇰🇷 한글 설명
Linux 커널의 iio: adc: spear 드라이버에서 인터럽트 핸들러를 등록하기 전에 완료 객체(completion)를 초기화하지 않아 발생하는 취약점입니다. 인터럽트가 초기화 전에 발생할 경우 초기화되지 않은 메모리에 접근하여 커널 패닉이 발생할 수 있습니다.
💡 쉬운 설명
장치가 작동을 시작하기도 전에 신호를 보내면, 컴퓨터가 준비되지 않은 상태에서 잘못된 명령을 처리하려다 시스템이 멈춰버리는 문제입니다. 이를 방지하기 위해 신호를 받을 준비를 먼저 마친 뒤에 신호를 받도록 순서를 바꿨습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iio: adc: spear: Initialize completion before requesting IRQ
In the report from Jaeyoung Chung:
"spear_adc_probe() in drivers/iio/adc/spear_adc.c registers its
interrupt handler with devm_request_irq() before it initializes
st->completion with init_completion(). If an interrupt arrives after
devm_request_irq() and before init_completion(), the handler calls
complete() on an uninitialized completion, causing a kernel panic.
The probe path, in spear_adc_probe():
iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); /* st kzalloc-zeroed */
...
retval = devm_request_irq(&pdev->dev, irq, spear_adc_isr, 0,
LPC32XXAD_NAME, st); /* register handler */
...
init_completion(&st->completion); /* initialize completion */
spear_adc_isr() calls complete():
complete(&st->completion);
If the device raises an interrupt before init_completion() runs,
complete() acquires the uninitialized wait.lock and walks the zeroed
task_list in swake_up_locked(). The zeroed task_list makes list_empty()
return false, so swake_up_locked() dereferences a NULL list entry,
triggering a KASAN wild-memory-access."
Fix the chance of a spurious IRQ causing an uninitialized pointer
dereference by moving init_completion() above devm_request_irq().
📍 영향받는 시스템
Linux kernel (iio: adc: spear driver 포함 버전)
⚔️ 공격 벡터
하드웨어 인터럽트를 의도적으로 발생시켜 초기화되지 않은 커널 메모리 참조 유도 (Local/Hardware level)
🛡️ 대응 방법
Linux 커널 패치를 적용하여 init_completion() 호출을 devm_request_irq() 이전으로 이동
🔧 검증 코드
해당 코드가 devm_request_irq() 호출보다 윗줄에 위치해 있는지 확인하여 수정 여부를 판단합니다.
grep -r "init_completion(&st->completion)" drivers/iio/adc/spear_adc.c