Commit c33fdfba authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Corey Minyard
Browse files

ipmi: fix oob access due to uninit smi_msg type



We're hitting OOB accesses in handle_ipmb_direct_rcv_rsp() (memcpy of
size -1) after user space generates a message. Looks like the message
is incorrectly assumed to be of the new IPMB type, because type is never
set and message is allocated with kmalloc() not kzalloc().

Fixes: 059747c2 ("ipmi: Add support for IPMB direct messages")
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Message-Id: <20211124210323.1950976-1-kuba@kernel.org>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 5a3ba99b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -5033,6 +5033,7 @@ struct ipmi_smi_msg *ipmi_alloc_smi_msg(void)
	if (rv) {
	if (rv) {
		rv->done = free_smi_msg;
		rv->done = free_smi_msg;
		rv->user_data = NULL;
		rv->user_data = NULL;
		rv->type = IPMI_SMI_MSG_TYPE_NORMAL;
		atomic_inc(&smi_msg_inuse_count);
		atomic_inc(&smi_msg_inuse_count);
	}
	}
	return rv;
	return rv;