🇰🇷 한글 설명
Linux 커널의 IPMI SI 드라이버에서 BMC 장치 ID를 가져오는 데 실패할 경우, 종료 콜백이 호출되지만 인터페이스의 종료 상태(in_shutdown)가 제대로 설정되지 않는 취약점입니다. 이로 인해 비동기 작업인 redo_bmc_reg가 이미 해제된 메모리(NULL 포인터)에 접근하여 커널 패닉을 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터의 관리 장치(BMC)와 통신하다가 오류가 발생했을 때, 시스템이 뒷정리를 제대로 하지 못해 발생하는 문제입니다. 이 과정에서 잘못된 메모리 주소를 참조하게 되어 시스템이 갑자기 멈추거나 재부팅될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ipmi: si: Fix NULL pointer dereference after failed registration
try_smi_init() allocates new_smi->si_sm and later calls
ipmi_register_smi_mod(), which maps to ipmi_add_smi().
During ipmi_add_smi(), the upper IPMI message handler obtains the
initial BMC device information through __bmc_get_device_id(). This can
fail if the BMC does not return a successful response to the Get Device
ID command.
When the BMC returns a nonzero completion code, the device-id helper
retries the command and eventually returns -EIO if the device ID still
cannot be fetched.
On this failure path, ipmi_add_smi() logs "Unable to get the device id"
and goes to out_err_started, where it invokes the lower driver's
shutdown callback. try_smi_init() then logs the returned registration
failure:
ipmi_si IPI0001:00: IPMI message handler: Unable to get the device id: -5
ipmi_si IPI0001:00: Unable to register device: error -5
For ipmi_si, the shutdown callback is shutdown_smi(), which cleans up
the SI state machine data, frees smi_info->si_sm, and sets
smi_info->si_sm and smi_info->intf to NULL.
However, intf->in_shutdown is not set on this failed-registration
rollback path. Therefore, the asynchronous redo_bmc_reg work item can
still retry BMC device-id probing after the lower driver has already
cleared its SI state machine data. In the observed case, that retry path
reached start_next_msg(), which passed the NULL smi_info->si_sm pointer
to the selected KCS state machine handler:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
Workqueue: events redo_bmc_reg [ipmi_msghandler]
RIP: start_kcs_transaction+0x2c/0x190 [ipmi_si]
Call Trace:
start_next_msg+0x50/0x80 [ipmi_si]
check_start_timer_thread.part.9+0x3b/0x50 [ipmi_si]
sender+0x69/0x80 [ipmi_si]
i_ipmi_request+0x2ac/0x9d0 [ipmi_msghandler]
__get_device_id.isra.29+0xaa/0x180 [ipmi_msghandler]
__bmc_get_device_id+0xef/0x950 [ipmi_msghandler]
redo_bmc_reg+0x52/0x60 [ipmi_msghandler]
process_one_work+0x1a7/0x360
Set intf->in_shutdown on the out_err_started path before invoking the
lower driver's shutdown callback. This prevents later redo_bmc_reg
retries from using an interface whose lower driver state has been
cleaned up, and applies the same shutdown state to other IPMI interfaces
as well.
📍 영향받는 시스템
Linux kernel (IPMI SI driver module)
⚔️ 공격 벡터
BMC가 Get Device ID 명령에 대해 비정상적인 응답을 보내거나 응답하지 않도록 유도하여 커널 패닉 유발
🛡️ 대응 방법
IPMI 등록 실패 시 out_err_started 경로에서 intf->in_shutdown을 설정하도록 커널 패치를 적용하십시오.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 패치 버전인지 확인하십시오.