hinic: fix rewaking txq after netif_tx_disable
authorLuo bin <luobin9@huawei.com>
Thu, 10 Sep 2020 14:04:40 +0000 (22:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 12 Sep 2020 00:23:57 +0000 (17:23 -0700)
commita1b80e0143a1b878f8e21d82fd55f3f46f0014be
tree324eb3596453fbf7c42b8af45083a31775a0c0fb
parentb5b73b26b3ca34574124ed7ae9c5ba8391a7f176
hinic: fix rewaking txq after netif_tx_disable

When calling hinic_close in hinic_set_channels, all queues are
stopped after netif_tx_disable, but some queue may be rewaken in
free_tx_poll by mistake while drv is handling tx irq. If one queue
is rewaken core may call hinic_xmit_frame to send pkt after
netif_tx_disable within a short time which may results in accessing
memory that has been already freed in hinic_close. So we call
napi_disable before netif_tx_disable in hinic_close to fix this bug.

Fixes: 2eed5a8b614b ("hinic: add set_channels ethtool_ops support")
Signed-off-by: Luo bin <luobin9@huawei.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/huawei/hinic/hinic_main.c
drivers/net/ethernet/huawei/hinic/hinic_tx.c