提交 c4e401e5 编写于 作者: H Huazhong Tan 提交者: David S. Miller

net: hns3: check resetting status in hns3_get_stats()

hns3_get_stats() should check the resetting status firstly,
since the device will be reinitialized when resetting. If the
reset has not completed, the hns3_get_stats() may access
invalid memory.
Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: NPeng Li <lipeng321@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 389775a6
...@@ -483,6 +483,11 @@ static void hns3_get_stats(struct net_device *netdev, ...@@ -483,6 +483,11 @@ static void hns3_get_stats(struct net_device *netdev,
struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
u64 *p = data; u64 *p = data;
if (hns3_nic_resetting(netdev)) {
netdev_err(netdev, "dev resetting, could not get stats\n");
return;
}
if (!h->ae_algo->ops->get_stats || !h->ae_algo->ops->update_stats) { if (!h->ae_algo->ops->get_stats || !h->ae_algo->ops->update_stats) {
netdev_err(netdev, "could not get any statistics\n"); netdev_err(netdev, "could not get any statistics\n");
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册