🇰🇷 한글 설명
Linux 커널의 driver core에서 device_add() 함수가 kobject_add() 실패 시 리소스를 제대로 해제하지 못하는 문제가 해결되었습니다. 이로 인해 동일한 이름의 장치를 중복 등록하려 할 때 mac80211_hwsim 모듈 로드가 실패할 수 있었습니다.
💡 쉬운 설명
장치를 등록하다 실패했을 때 사용하던 메모리 자원이 정리되지 않고 남아 있는 버그입니다. 같은 이름의 장치를 다시 만들려 하면 모듈 로딩이 실패하는 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
driver core: fix resource leak in device_add()
When calling kobject_add() failed in device_add(), it will call
cleanup_glue_dir() to free resource. But in kobject_add(),
dev->kobj.parent has been set to NULL. This will cause resource leak.
The process is as follows:
device_add()
get_device_parent()
class_dir_create_and_add()
kobject_add() //kobject_get()
...
dev->kobj.parent = kobj;
...
kobject_add() //failed, but set dev->kobj.parent = NULL
...
glue_dir = get_glue_dir(dev) //glue_dir = NULL, and goto
//"Error" label
...
cleanup_glue_dir() //becaues glue_dir is NULL, not call
//kobject_put()
The preceding problem may cause insmod mac80211_hwsim.ko to failed.
sysfs: cannot create duplicate filename '/devices/virtual/mac80211_hwsim'
Call Trace:
<TASK>
dump_stack_lvl+0x8e/0xd1
sysfs_warn_dup.cold+0x1c/0x29
sysfs_create_dir_ns+0x224/0x280
kobject_add_internal+0x2aa/0x880
kobject_add+0x135/0x1a0
get_device_parent+0x3d7/0x590
device_add+0x2aa/0x1cb0
device_create_groups_vargs+0x1eb/0x260
device_create+0xdc/0x110
mac80211_hwsim_new_radio+0x31e/0x4790 [mac80211_hwsim]
init_mac80211_hwsim+0x48d/0x1000 [mac80211_hwsim]
do_one_initcall+0x10f/0x630
do_init_module+0x19f/0x5e0
load_module+0x64b7/0x6eb0
__do_sys_finit_module+0x140/0x200
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
</TASK>
kobject_add_internal failed for mac80211_hwsim with -EEXIST, don't try to
register things with the same name in the same directory.
📍 영향받는 시스템
패치 이전의 Linux 커널 (mac80211_hwsim 등 장치 등록 경로를 사용하는 환경)
⚔️ 공격 벡터
원격 공격 경로는 명확하지 않으며 주로 장치 중복 등록 시 발생하는 안정성(리소스 누수) 문제입니다.
🛡️ 대응 방법
배포판이 제공하는 최신 커널 보안 업데이트를 적용하고 재부팅합니다.
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지에서 해당 CVE 수정이 포함된 버전과 비교하여, 수정 버전 이상이면 패치된 것입니다.