]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: fix use-after-free bug in hclgevf_send_mbx_msg
authorJie Wang <wangjie125@huawei.com>
Fri, 10 Dec 2021 13:09:33 +0000 (21:09 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 12 Dec 2021 16:20:50 +0000 (16:20 +0000)
commit5384b1f3461ddfc17e8a61dfb15180181e7fbe58
treeaecafcd33925806d4a42f4856bf8b00ccee040e6
parent6955d7e6a43cd694d81a17f4dfc663b8af6a6bb6
net: hns3: fix use-after-free bug in hclgevf_send_mbx_msg

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: 5a80f6ec39d2 ("net: hns3: add trace event support for PF/VF mailbox")
Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c