🇰🇷 한글 설명
Linux 커널의 arc_uart 시리얼 드라이버에서 arc_serial_probe 함수 실행 시, uart_add_one_port()가 실패하면 of_iomap()으로 매핑한 port->membase가 해제되지 않아 리소스 누수가 발생합니다. 이를 devm_platform_ioremap_resource 사용으로 수정하여 해결했습니다.
💡 쉬운 설명
시리얼 포트 드라이버를 초기화하는 과정에서 실패하면 메모리 일부가 반환되지 않고 남아 있습니다. 이 문제는 장시간 반복 시 시스템 자원을 조금씩 소모하게 만듭니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
serial: arc_uart: fix of_iomap leak in `arc_serial_probe`
Smatch reports:
drivers/tty/serial/arc_uart.c:631 arc_serial_probe() warn:
'port->membase' from of_iomap() not released on lines: 631.
In arc_serial_probe(), if uart_add_one_port() fails,
port->membase is not released, which would cause a resource leak.
To fix this, I replace of_iomap with devm_platform_ioremap_resource.
📍 영향받는 시스템
ARC 아키텍처 기반 임베디드 시스템에서 사용되는 arc_uart 드라이버를 포함한 Linux 커널 (수정 커밋 적용 이전 버전)
⚔️ 공격 벡터
직접적인 원격 공격 경로는 없으며, 드라이버 초기화 실패가 반복되는 상황에서 메모리 리소스 고갈을 유발할 수 있는 로컬 리소스 누수 결함입니다.
🛡️ 대응 방법
리눅스 커널을 devm_platform_ioremap_resource를 적용한 최신 안정 버전으로 업데이트하거나 해당 패치를 backport 합니다.
🔧 검증 코드
커널 버전을 확인한 뒤 arc_uart 소스에서 devm_platform_ioremap_resource가 보이고 of_iomap이 probe 경로에 없으면 패치가 적용된 것이고, of_iomap만 존재하면 취약한 상태입니다.
uname -r && grep -n 'devm_platform_ioremap_resource\|of_iomap' $(find /usr/src /lib/modules -path '*arc_uart*' -name '*.c' 2>/dev/null | head -1) 2>/dev/null