提交 dcd93089 编写于 作者: J Jie Wang 提交者: Yonglong Liu

net: hns3: fix use-after-free bug in hclgevf_send_mbx_msg

mainline inclusion
from mainline-v5.16-rc6
commit 27cbf64a
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7OQ7U
CVE: NA

----------------------------

Currently, the hns3_remove function firstly uninstall client instance,
and then uninstall acceletion engine device. The netdevice is freed in
client instance uninstall process, but acceletion engine device uninstall
process still use it to trace runtime information. This causes a use after
free problem.

So fixes it by check the instance register state to avoid use after free.

Fixes: d8355240 ("net: hns3: add trace event support for PF/VF mailbox")
Signed-off-by: NJie Wang <wangjie125@huawei.com>
Signed-off-by: NYonglong Liu <liuyonglong@huawei.com>
上级 39c7fc1c
......@@ -136,7 +136,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,
memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg));
trace_hclge_vf_mbx_send(hdev, req);
if (test_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state))
trace_hclge_vf_mbx_send(hdev, req);
/* synchronous send */
if (need_resp) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册