🇰🇷 한글 설명
Linux 커널의 V4L2 드라이버에서 오류 처리 로직 오류로 인해 발생한 이중 해제(Double-free) 취약점입니다. 이전 패치가 리소스 해제 과정에서 이미 해제된 구조체를 다시 해제하려고 시도하여 시스템 불안정성을 초래할 수 있었기에, 해당 패치를 되돌려 메모리 누수를 허용하는 대신 안정성을 선택했습니다.
💡 쉬운 설명
컴퓨터가 사용하던 메모리를 정리하는 과정에서 이미 버린 메모리를 또 버리려고 시도하여 시스템이 고장 날 수 있는 문제입니다. 이를 방지하기 위해 문제가 될 수 있는 복잡한 정리 방식을 이전의 단순한 방식으로 되돌렸습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Revert "media: v4l2-dev: fix error handling in __video_register_device()"
This reverts commit 2a934fdb01db6458288fc9386d3d8ceba6dd551a.
The intentions of that patch were good, but it doesn't work.
The idea is that if device_register fails, you have to do a put_device
to let the ref counter release resources.
However, the V4L2 API says that if video_register_device() fails, then
you have to call video_device_release(), which kfree()s the video_device
struct.
But the put_device() will already have freed the struct, so you end
up in a double-free scenario.
There is not really a good way of fixing this without breaking
video_register_device() into two parts, one that initializes everything,
and one that does the actual device_register, and then converting all
V4L2 drivers to this new model.
That is a massive job, and it is very unlikely that device_register
will fail.
So rather than ending up in a double-free scenario, just revert this
patch, and in that case we'll have a small memory leak. Which is a lot
more robust.
📍 영향받는 시스템
Linux kernel (V4L2 관련 드라이버를 사용하는 시스템)
⚔️ 공격 벡터
특정 하드웨어 장치 등록 과정에서 의도적인 오류를 유도하여 메모리 이중 해제 발생 유도
🛡️ 대응 방법
해당 커널 패치가 적용되지 않은 안정적인 버전의 커널로 업데이트하거나, 관련 커밋(2a934fdb)이 포함되지 않은 버전을 사용하십시오.
🔧 검증 코드
명령어 결과에 해당 커밋을 되돌리는(Revert) 로그가 나타나면 취약점이 해결된 상태입니다.
git log -p --grep='2a934fdb01db6458288fc9386d3d8ceba6dd551a' | grep -E 'Revert|commit'