🇰🇷 한글 설명
Linux 커널의 SPI LPSPI 드라이버 probe() 함수에서 메모리를 수동으로 할당/해제하면서 devm 관리 기능을 함께 사용하여, 오류 발생 시 이미 해제된 메모리를 참조하는 use-after-free 취약점이 존재합니다. 이로 인해 커널 NULL 포인터 역참조가 발생할 수 있습니다.
💡 쉬운 설명
리눅스 커널의 특정 장치 드라이버에서 메모리를 이미 해제한 뒤 다시 사용하는 오류가 있습니다. 이로 인해 시스템이 비정상 종료되거나 불안정해질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
spi: lpspi: Avoid potential use-after-free in probe()
fsl_lpspi_probe() is allocating/disposing memory manually with
spi_alloc_host()/spi_alloc_target(), but uses
devm_spi_register_controller(). In case of error after the latter call the
memory will be explicitly freed in the probe function by
spi_controller_put() call, but used afterwards by "devm" management outside
probe() (spi_unregister_controller() <- devm_spi_unregister() below).
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070
...
Call trace:
kernfs_find_ns
kernfs_find_and_get_ns
sysfs_remove_group
sysfs_remove_groups
device_remove_attrs
device_del
spi_unregister_controller
devm_spi_unregister
release_nodes
devres_release_all
really_probe
driver_probe_device
__device_attach_driver
bus_for_each_drv
__device_attach
device_initial_probe
bus_probe_device
deferred_probe_work_func
process_one_work
worker_thread
kthread
ret_from_fork
📍 영향받는 시스템
Linux 커널 (SPI lpspi 드라이버를 사용하는 임베디드/NXP i.MX 등 장치의 커널 버전, 수정 패치 적용 전)
⚔️ 공격 벡터
로컬 사용자 또는 장치 프로브 과정에서 드라이버 오류를 유발하여 커널 패닉 또는 서비스 거부(DoS)를 일으킬 수 있음
🛡️ 대응 방법
Linux 커널을 수정 패치가 포함된 최신 안정 버전으로 업데이트
🔧 검증 코드
커널 버전이 패치된 버전 이상인지 확인하고, lpspi 모듈이 로드되어 있다면 해당 커널이 취약할 가능성이 있으므로 패치 여부를 배포판 보안 공지로 확인
uname -r && grep -i lpspi /proc/modules 2>/dev/null