Patch "net: hns3: fix use-after-free bug in hclgevf_send_mbx_msg" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-hns3-fix-use-after-free-bug-in-hclgevf_send_mbx_.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8a9e27ff4ef77775a6493fbcd796c35450b8a544
Author: Jie Wang <wangjie125@xxxxxxxxxx>
Date:   Fri Dec 10 21:09:33 2021 +0800

    net: hns3: fix use-after-free bug in hclgevf_send_mbx_msg
    
    [ Upstream commit 27cbf64a766e86f068ce6214f04c00ceb4db1af4 ]
    
    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: d8355240cf8f ("net: hns3: add trace event support for PF/VF mailbox")
    Signed-off-by: Jie Wang <wangjie125@xxxxxxxxxx>
    Signed-off-by: Guangbin Huang <huangguangbin2@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
index 5b2dcd97c1078..b8e5ca6700ed5 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
@@ -109,7 +109,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) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux