🇰🇷 한글 설명
Linux 커널 wave5 미디어 드라이버의 폴링 모드에서 kthread worker 정리 순서 오류로 인해 모듈 제거 시 커널 경고가 발생합니다. hrtimer를 kthread_destroy_worker() 후에 취소할 경우 타이머가 발동하면서 이미 파괴된 worker에 작업을 큐잉하려 하는 경합 상태가 발생합니다. 올바른 순서(hrtimer_cancel 먼저, 그 다음 kthread_destroy_worker)로 정리해야 합니다.
💡 쉬운 설명
리눅스 드라이버가 종료될 때 정리하는 순서가 잘못되어 경고 메시지가 발생하는 문제입니다. 정리 순서를 바꾸면 경고 없이 깔끔하게 종료됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
media: chips-media: wave5: Fix kthread worker destruction in polling mode
Fix the cleanup order in polling mode (irq < 0) to prevent kernel warnings
during module removal. Cancel the hrtimer before destroying the kthread
worker to ensure work queues are empty.
In polling mode, the driver uses hrtimer to periodically trigger
wave5_vpu_timer_callback() which queues work via kthread_queue_work().
The kthread_destroy_worker() function validates that both work queues
are empty with WARN_ON(!list_empty(&worker->work_list)) and
WARN_ON(!list_empty(&worker->delayed_work_list)).
The original code called kthread_destroy_worker() before hrtimer_cancel(),
creating a race condition where the timer could fire during worker
destruction and queue new work, triggering the WARN_ON.
This causes the following warning on every module unload in polling mode:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 1034 at kernel/kthread.c:1430
kthread_destroy_worker+0x84/0x98
Modules linked in: wave5(-) rpmsg_ctrl rpmsg_char ...
Call trace:
kthread_destroy_worker+0x84/0x98
wave5_vpu_remove+0xc8/0xe0 [wave5]
platform_remove+0x30/0x58
...
---[ end trace 0000000000000000 ]---
📍 영향받는 시스템
Linux kernel wave5 미디어 드라이버 (폴링 모드 사용 시)
⚔️ 공격 벡터
Local (모듈 제거 권한 필요, 직접적인 공격 벡터 아님)
🛡️ 대응 방법
kernel을 수정 버전으로 업그레이드하거나 해당 패치 적용
🔧 검증 코드
wave5 드라이버가 설치되어 있으면 영향을 받습니다. 커널 버전과 패치 적용 여부를 확인하여 update 필요 여부를 판단하세요.
modinfo wave5 2>/dev/null | grep -q . && echo 'wave5 드라이버 설치됨' || echo '미설치'