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 judge
whether the netdev is in down state before waking txq in free_tx_poll
to fix this bug.
Signed-off-by: Luo bin <redacted>
---
drivers/net/ethernet/huawei/hinic/hinic_tx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Jakub Kicinski <kuba@kernel.org> Date: 2020-09-07 21:28:56
On Mon, 7 Sep 2020 22:15:16 +0800 Luo bin wrote:
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 judge
whether the netdev is in down state before waking txq in free_tx_poll
to fix this bug.
The right fix is to call napi_disable() _before_ you call
netif_tx_disable(), not after, like hinic_close() does.
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 judge
whether the netdev is in down state before waking txq in free_tx_poll
to fix this bug.
The right fix is to call napi_disable() _before_ you call
netif_tx_disable(), not after, like hinic_close() does.
.