Skip to content

Commit b2879e2

Browse files
committed
net: hns3: fix use-after-free bug in hclgevf_send_mbx_msg
jira VULN-63094 cve CVE-2021-47596 commit-author Jie Wang <[email protected]> commit 27cbf64 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: d835524 ("net: hns3: add trace event support for PF/VF mailbox") Signed-off-by: Jie Wang <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 27cbf64) Signed-off-by: Brett Mastbergen <[email protected]>
1 parent c40f65a commit b2879e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,
114114

115115
memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg));
116116

117-
trace_hclge_vf_mbx_send(hdev, req);
117+
if (test_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state))
118+
trace_hclge_vf_mbx_send(hdev, req);
118119

119120
/* synchronous send */
120121
if (need_resp) {

0 commit comments

Comments
 (0)