mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 21:45:45 +02:00
net: hns3: add validity check for message data length
[ Upstream commit7d413735cb] Add validity check for message data length in function hclge_send_mbx_msg(), avoid unexpected overflow. Fixes:dde1a86e93("net: hns3: Add mailbox support to PF driver") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e3ec78d82d
commit
929c30c02d
|
|
@ -91,6 +91,13 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,
|
||||||
enum hclge_cmd_status status;
|
enum hclge_cmd_status status;
|
||||||
struct hclge_desc desc;
|
struct hclge_desc desc;
|
||||||
|
|
||||||
|
if (msg_len > HCLGE_MBX_MAX_MSG_SIZE) {
|
||||||
|
dev_err(&hdev->pdev->dev,
|
||||||
|
"msg data length(=%u) exceeds maximum(=%u)\n",
|
||||||
|
msg_len, HCLGE_MBX_MAX_MSG_SIZE);
|
||||||
|
return -EMSGSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;
|
resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;
|
||||||
|
|
||||||
hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);
|
hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user