🇰🇷 한글 설명
Linux 커널의 hns3 드라이버에서 tx_spare 버퍼에 대한 이중 해제(double free) 취약점이 발견되었습니다. hns3_set_ringparam() 함수에서 롤백을 위해 구조체를 복사할 때 tx_spare 포인터를 적절히 초기화하지 않아, 메모리 할당 실패 시 이미 해제된 메모리를 다시 해제하려고 시도하는 문제가 발생합니다.
💡 쉬운 설명
컴퓨터 메모리를 관리하는 과정에서 이미 사용이 끝난 메모리 주소를 실수로 다시 지우려고 시도하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 보안상 취약점이 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: hns3: fix double free issue for tx spare buffer
In hns3_set_ringparam(), a temporary copy (tmp_rings) of the ring structure
is created for rollback. However, the tx_spare pointer in the original
ring handle is incorrectly left pointing to the old backup memory.
Later, if memory allocation fails in hns3_init_all_ring() during the setup,
the error path attempts to free all newly allocated rings. Since tx_spare
contains a stale (non-NULL) pointer from the backup, it is mistaken for
a newly allocated buffer and is erroneously freed, leading to a double-free
of the backup memory.
The root cause is that the tx_spare field was not cleared after its value
was saved in tmp_rings, leaving a dangling pointer.
Fix this by setting tx_spare to NULL in the original ring structure
when the creation of the new `tx_spare` fails. This ensures the
error cleanup path only frees genuinely newly allocated buffers.
📍 영향받는 시스템
Linux kernel (hns3 driver module)
⚔️ 공격 벡터
메모리 할당 실패를 유도하는 특정 네트워크 설정 변경 시도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.