🇰🇷 한글 설명
Linux 커널의 mtd 모듈에서 add_mtd_device() 오류 처리 중 mtd_info 구조체가 중복 해제되는 double free 취약점과 WARN_ON 오류가 발견되었습니다. 오류 발생 시 장치 등록 해제 과정에서 파티션 노드가 리스트에 남아 있어 발생하는 문제로, 이를 해결하기 위해 오류 경로에서 장치 해제 콜백을 수정하였습니다.
💡 쉬운 설명
리눅스 시스템에서 메모리 장치를 설정하다가 오류가 발생할 때, 이미 삭제된 메모리를 다시 삭제하려고 시도하여 시스템이 충돌하거나 불안정해질 수 있는 문제입니다. 이 문제는 메모리 관리 방식의 논리적 오류로 인해 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mtd: fix double free and WARN_ON in add_mtd_device() error paths
When device_register() or mtd_nvmem_add() fails inside
add_mtd_device() for a partition, the error handling triggers
mtd_release() via put_device() or device_unregister(). mtd_release()
calls release_mtd_partition() which frees the mtd_info structure.
However, callers such as mtd_add_partition() and add_mtd_partitions()
also call free_partition() in their error paths, resulting in a double
free.
Additionally, release_mtd_partition() hits WARN_ON(!list_empty(
&mtd->part.node)) because the partition node is still linked in the
parent's partitions list when the release callback fires from the
add_mtd_device() error path.
Fix this by overriding dev->type and dev->release before put_device()
in the error paths, so that device_release() invokes a no-op function
instead of mtd_release(). For the mtd_nvmem_add() failure case,
device_unregister() is replaced with device_del() to separate the
device removal from the final kobject reference drop, allowing the
override to take effect before put_device() is called.
The callers' error paths (list_del + free_partition) remain the sole
owners of mtd_info lifetime on add_mtd_device() failure, which is the
expected contract.
The normal partition teardown path is not affected: del_mtd_device()
goes through kref_put() -> mtd_device_release() -> device_unregister()
with dev->type still set to &mtd_devtype, so mtd_release() ->
release_mtd_partition() continues to work correctly for the regular
removal case.
📍 영향받는 시스템
Linux Kernel (MTD subsystem 사용 시스템)
⚔️ 공격 벡터
로컬 공격자가 MTD 파티션 추가 과정에서 의도적으로 오류를 유발하여 시스템 충돌(DoS)을 일으킬 수 있음
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 수정된 패치 버전인지 확인하십시오.