提交 e9a20c30 编写于 作者: H Huazhong Tan 提交者: Xie XiuQi

net: hns3: check resetting status when doing VLAN ops

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

The VLAN ops should check the resetting status firstly,
since the device will be reinitialized when resetting. If the
reset has not completed, the VLAN ops may access invalid memory.
And this checking can make it return as soon as possible.

Feature or Bugfix:Bugfix
Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
Reviewed-by: Nshenjian <shenjian15@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 6afa66ae
......@@ -1641,6 +1641,9 @@ static int hns3_vlan_rx_add_vid(struct net_device *netdev,
struct hnae3_handle *h = hns3_get_handle(netdev);
int ret = -EIO;
if (hns3_nic_resetting(netdev))
return -EBUSY;
if (h->ae_algo->ops->set_vlan_filter)
ret = h->ae_algo->ops->set_vlan_filter(h, proto, vid, false);
......@@ -1653,6 +1656,9 @@ static int hns3_vlan_rx_kill_vid(struct net_device *netdev,
struct hnae3_handle *h = hns3_get_handle(netdev);
int ret = -EIO;
if (hns3_nic_resetting(netdev))
return -EBUSY;
if (h->ae_algo->ops->set_vlan_filter)
ret = h->ae_algo->ops->set_vlan_filter(h, proto, vid, true);
......@@ -1674,6 +1680,9 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
__be16 vlan_proto = htons(ETH_P_8021Q);
#endif
if (hns3_nic_resetting(netdev))
return -EBUSY;
if (h->ae_algo->ops->set_vf_vlan_filter)
ret = h->ae_algo->ops->set_vf_vlan_filter(h, vf, vlan,
qos, vlan_proto);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册