🇰🇷 한글 설명
Linux 커널의 ibm: emac 드라이버에서 장치 제거 시 Use-After-Free 취약점이 발견되었습니다. devm_register_netdev() 사용으로 인해 하드웨어 자원이 해제된 후 네트워크 스택이 장치를 참조하여 발생하는 문제입니다.
💡 쉬운 설명
컴퓨터 부품을 제거하는 과정에서, 부품은 이미 사라졌는데 운영체제가 여전히 그 부품을 사용하려고 시도하여 시스템 오류가 발생하는 문제입니다. 이로 인해 시스템이 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: ibm: emac: Fix use-after-free during device removal
The driver was using devm_register_netdev() which causes unregister_netdev()
to be deferred until the devres cleanup phase, which runs after emac_remove()
returns. This creates a use-after-free window where:
1. emac_remove() is called, which tears down hardware (cancels work, detaches
modules, unregisters from MAL)
2. emac_remove() returns
3. devres cleanup runs and finally calls unregister_netdev()
During step 3, the network stack might still process packets, triggering
emac_irq(), emac_poll(), or other handlers that access now-freed hardware
resources (dev->emacp, dev->mal, etc.).
Fix this by replacing devm_register_netdev() with manual register_netdev()
and calling unregister_netdev() at the beginning of emac_remove(), before
any hardware teardown. This ensures the network device is fully stopped and
unregistered before hardware resources are released.
The change is safe because:
- dev->ndev is assigned very early in probe (before any error paths that
could bypass emac_remove)
- platform_set_drvdata() is only called after successful registration, so
emac_remove() only runs for fully registered devices
- unregister_netdev() is idempotent and safe to call on any registered device
📍 영향받는 시스템
IBM emac 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
장치 제거(Device Removal) 과정 중 네트워크 패킷 처리를 유도하여 메모리 오류 유발
🛡️ 대응 방법
devm_register_netdev()를 register_netdev()로 교체하고, emac_remove() 시작 시점에 unregister_netdev()를 명시적으로 호출하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전인지 확인